[PATCH] D73618: [DebugInfo] Check that we do not run past a line table end when parsing

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 30 02:50:59 PST 2020


ikudrin added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp:924
+  // where the overflowing opcode appears at the end of the section. However, in
+  // such cases, an unterminated sequence error will be raised instead, as the
+  // data extractor will return zeroes for the trailing bytes (which do not
----------------
I guess that the comment is not 100% accurate. Let's imagine the following purely illustrative and meaningless sequence at the end of the section: `0`, `5`, `DW_LNE_set_address`, `0`, `1`, `DW_LNE_end_sequence`. The extractor will not read an argument of `DW_LNE_set_address` and will not increment the offset, but after that, something which looks like a correct termination will be read.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp:927
+  // correspond to an end sequence instruction).
+  if (*OffsetPtr > EndOffset) {
+    RecoverableErrorCallback(createStringError(
----------------
Maybe it is more consistent to put this code before the previous check. I mean, this check is comparatively low level, and if it triggers, the input is probably corrupted so deeply that it makes no sense to interpret it, no?






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