Commit 6ab21f0f authored by Nick Mathewson's avatar Nick Mathewson 🦀
Browse files

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.
parent 40c85488
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2632,6 +2632,7 @@ class ParseFnGenerator(CodeGenerator):

            elt = "obj->%s.elts_" % sva.c_name

            if sva.widthfield != None:
                self.needLabels.add(self.truncatedLabel)

            if str(sva.basetype) == 'char':
+4 −0
Original line number Diff line number Diff line

struct simple_body {
   u8 body[];
}
 No newline at end of file