From 9e59fd2422f62e7e117dc3db0843becd8c3f2842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neboj=C5=A1a=20Cvetkovi=C4=87?= Date: Tue, 3 Nov 2026 13:54:33 -0500 Subject: [PATCH] [spec] require an SoA record to take at least one byte A schema of Z fields, fixed-length S or H fields of length 0, or nested objects and arrays of those, describes records of no bytes, so the count is bounded by nothing in the data: a few bytes can declare any number of records. This is the zero-length-marker problem that the optimized type header already excludes T, F, Z and N for. Require a record's fields to total at least one byte, and a parser to reject a container whose schema does not, whatever its count. --- Binary_JData_Specification.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Binary_JData_Specification.md b/Binary_JData_Specification.md index 664e32a..e477e7b 100644 --- a/Binary_JData_Specification.md +++ b/Binary_JData_Specification.md @@ -494,7 +494,9 @@ and container types (`[,{`) shall not be used in an optimized _type_ header. This restriction reduces security risks from potential buffer-overflow attacks via [zero-length markers](https://github.com/nlohmann/json/issues/2793), and avoids the reduced readability and diminished efficiency that variable-length or -container types would bring in an optimized format. +container types would bring in an optimized format. The same holds for a +[Structure-of-Arrays](#structure-of-arrays) container: its schema shall describe +records of at least one byte. The requirements for _type_ are @@ -711,6 +713,10 @@ array-spec = '[' 1*(type-spec) ']' // fixed array with explicit element 6. No optimized containers can be used inside the schema, except in the case of serving as dictionary/offset-table markers for variable-length strings, as described in #4 above 7. `F` and `N` are not used in schema (use `T` for boolean, `Z` for null) +8. A record must occupy at least one byte of payload: a schema whose fields total zero bytes, + such as one of only `Z` fields or zero-length `S`/`H` fields, shall not be used, since its + `` would be unbounded by the data. A parser shall reject such a container whatever + its count. ---