This is an automated email from the git hooks/post-receive script.
nickm pushed a commit to branch main in repository trunnel.
The following commit(s) were added to refs/heads/main by this push: new 6d24296 Do not generate a `truncated:` for u8[] at end of struct 6d24296 is described below
commit 6d24296e10554867f974115e341762f06cfdccbf Author: Nick Mathewson nickm@torproject.org AuthorDate: Thu May 5 08:43:11 2022 -0400
Do not generate a `truncated:` for u8[] at end of struct
Our previous rule had been that all u8 arrays needed a `truncated:` section. That's fine if the arrays have a length, but not if their length extends to the end of the structure: such arrays can't be truncated. --- lib/trunnel/CodeGen.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/trunnel/CodeGen.py b/lib/trunnel/CodeGen.py index e7ad11c..22dd8b8 100644 --- a/lib/trunnel/CodeGen.py +++ b/lib/trunnel/CodeGen.py @@ -2223,7 +2223,8 @@ class EncodeFnGenerator(CodeGenerator):
self.eltHeader(sva) if arrayIsBytes(sva): - self.needTruncated = True + if sva.widthfield is not None: + self.needTruncated = True self.format(""" {{ size_t elt_len = TRUNNEL_DYNARRAY_LEN(&obj->{c_name});
tor-commits@lists.torproject.org