[PATCH] D80299: [DebugInfo] - Fix multiple issues in DWARFDebugFrame::parse().

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 20 08:11:01 PDT 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay, dblaikie, probinson, aprantl, ikudrin.
Herald added subscribers: rupprecht, atanasyan, hiraditya, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

I've noticed an issue with "Data.getRelocatedValue(...)" call.

it might silently ignore an error when a content is truncated.
That leads to an infinite loop in the code (e.g. llvm-readobj hangs).

After fixing the issue I've found that actually we always tried
to read past the end of a section, even when a content was valid.
It happened because the terminator CIE (a CIE with the length == 0)
was never handled. At first I've tried just to stop adding the terminator
entry (and return), but it does not seem to be correct, because tools like
llvm-objdump might want to print something for such entries
(see comments in the code and test cases).

This patch fixes issues mentioned, provides new test cases for
both llvm-readobj and lib/DebugInfo and adds FIXMEs to existent
test cases related.


https://reviews.llvm.org/D80299

Files:
  llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
  llvm/test/DebugInfo/X86/eh-frame-truncated.s
  llvm/test/tools/llvm-objdump/eh_frame-mipsel.test
  llvm/test/tools/llvm-objdump/eh_frame_zero_cie.test
  llvm/test/tools/llvm-readobj/ELF/unwind.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80299.265252.patch
Type: text/x-patch
Size: 4158 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200520/483a9fa4/attachment-0001.bin>


More information about the llvm-commits mailing list