This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Avoid a crash when parsing an invalid unit header in DWP.
ClosedPublic

Authored by ikudrin on Feb 26 2020, 7:13 AM.

Details

Summary

The integrity checks for index entries in DWARFUnitHeader::extract() might cause the function to return before checking the state of an Error object, which leads to a crash in runtime. The patch fixes the issue by moving the checks in a safe place.

Diff Detail

Event Timeline

ikudrin created this revision.Feb 26 2020, 7:13 AM
jhenderson accepted this revision.Feb 27 2020, 2:15 AM

LGTM. Just wondering, did you consider writing a unittest instead?

llvm/test/DebugInfo/X86/invalid-cu-length-dwp.s
55

Nit: ##

This revision is now accepted and ready to land.Feb 27 2020, 2:15 AM
ikudrin updated this revision to Diff 246901.Feb 27 2020, 2:31 AM
ikudrin marked an inline comment as done.
  • Fixed a comment mark.

Just wondering, did you consider writing a unittest instead?

Well, as there is no support for these sections in DWARFYAML I suppose the test would not be that expressive as the lit one. Do you want me to try anyway?

This revision was automatically updated to reflect the committed changes.