[PATCH] D73618: [DebugInfo] Check that we do not run past a line table end when parsing
Pavel Labath via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 30 23:57:48 PST 2020
labath added a comment.
In D73618#1850803 <https://reviews.llvm.org/D73618#1850803>, @dblaikie wrote:
> @labath - maybe some other parts of the DWARF parsing that could benefit from a constrained DWARFDataExtractor
I think that pretty much everything would benefit from a data extractor constrained in this way. Prefixing the content with length is used in nearly every dwarf section, and so in theory, everything should be checking that it does not cross the specified length. I've seen code which attempts to do that via something like `while(!endReached() && data.isValidOffset(*Offset) && *Offset < EndOffset) parseOneThing(Offset)`, but that is:
a) complicated
b) probably incorrect, because the end boundary is only checked at the end of the `parseOneThing` call, so we can still cross that boundary if the "one thing" is sitting on both sides of the boundary
If we had a "constrained" data extractor, then we wouldn't need the `*Offset < EndOffset` check, because the extractor would check that for us (and it would do that _everywhere_). It would also allow us to treat the "'thing' crosses a contribution boundary, but there is another contribution after it" and "'thing' crosses a contribution boundary, but hits the end of the section" cases uniformly, because as far as the code would be concerned, everything would be at the end of the section.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73618/new/
https://reviews.llvm.org/D73618
More information about the llvm-commits
mailing list