[PATCH] D82886: [DebugInfo] Fix a possible crash when reading a malformed .debug_*lists section.

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 7 03:25:06 PDT 2020


ikudrin added a comment.

In D82886#2134722 <https://reviews.llvm.org/D82886#2134722>, @dblaikie wrote:

> Is that difference necessary? I tried removing the length == 0 special case from "length()" and no tests fail. Perhaps we could go that route instead?


For example, `dumpRnglistsSection()` in `DWARFContext.cpp` terminates the loop when `length()` returns 0. With a specially constructed input, your variant would result in several additional unsuccessful reads with additional error messages:

      .section .debug_rnglists,"", at progbits
      .long 0xffffffff
      .long 0xffffffff
      .byte 0xff
  ...
  error: parsing .debug_rnglists table at offset 0x0: unexpected end of data at offset 0xb while reading [0x4, 0xc)
  error: parsing .debug_rnglists table at offset 0x4: unexpected end of data at offset 0xb while reading [0x8, 0x10)
  error: parsing .debug_rnglists table at offset 0x8: unexpected end of data at offset 0xb while reading [0x8, 0xc)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82886/new/

https://reviews.llvm.org/D82886





More information about the llvm-commits mailing list