This is an automated email from the git hooks/post-receive script.
nickm pushed a change to branch main in repository trunnel.
from 6d24296 Do not generate a `truncated:` for u8[] at end of struct new 40c8548 Revert "Do not generate a `truncated:` for u8[] at end of struct" new 6ab21f0 Do not generate a `truncated:` for _parsing_ u8[] at end of struct
The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
Summary of changes: lib/trunnel/CodeGen.py | 6 +++--- test/valid/end_of_struct.trunnel | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 test/valid/end_of_struct.trunnel
This is an automated email from the git hooks/post-receive script.
nickm pushed a commit to branch main in repository trunnel.
commit 40c8548809d479d95e0d59efc383572ce97c0a37 Author: Nick Mathewson nickm@torproject.org AuthorDate: Thu May 5 08:48:14 2022 -0400
Revert "Do not generate a `truncated:` for u8[] at end of struct"
This reverts commit 6d24296e10554867f974115e341762f06cfdccbf.
I was modifying an _encode_ function when I should have modified the _decode_ function. --- lib/trunnel/CodeGen.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/trunnel/CodeGen.py b/lib/trunnel/CodeGen.py index 22dd8b8..e7ad11c 100644 --- a/lib/trunnel/CodeGen.py +++ b/lib/trunnel/CodeGen.py @@ -2223,8 +2223,7 @@ class EncodeFnGenerator(CodeGenerator):
self.eltHeader(sva) if arrayIsBytes(sva): - if sva.widthfield is not None: - self.needTruncated = True + self.needTruncated = True self.format(""" {{ size_t elt_len = TRUNNEL_DYNARRAY_LEN(&obj->{c_name});
This is an automated email from the git hooks/post-receive script.
nickm pushed a commit to branch main in repository trunnel.
commit 6ab21f0f9315dbe5ee74b5737a0d87276cad980c Author: Nick Mathewson nickm@torproject.org AuthorDate: Thu May 5 08:43:11 2022 -0400
Do not generate a `truncated:` for _parsing_ 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.
This time I also add a test to make sure change works. --- lib/trunnel/CodeGen.py | 3 ++- test/valid/end_of_struct.trunnel | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/trunnel/CodeGen.py b/lib/trunnel/CodeGen.py index e7ad11c..f7a8ca3 100644 --- a/lib/trunnel/CodeGen.py +++ b/lib/trunnel/CodeGen.py @@ -2632,7 +2632,8 @@ class ParseFnGenerator(CodeGenerator):
elt = "obj->%s.elts_" % sva.c_name
- self.needLabels.add(self.truncatedLabel) + if sva.widthfield != None: + self.needLabels.add(self.truncatedLabel)
if str(sva.basetype) == 'char': tp = "char" diff --git a/test/valid/end_of_struct.trunnel b/test/valid/end_of_struct.trunnel new file mode 100644 index 0000000..4c5e7b3 --- /dev/null +++ b/test/valid/end_of_struct.trunnel @@ -0,0 +1,4 @@ + +struct simple_body { + u8 body[]; +} \ No newline at end of file
tor-commits@lists.torproject.org