This is an archive of the discontinued LLVM Phabricator instance.

Fix crash when using embedded DWARF-5 debugging info
AbandonedPublic

Authored by amadio on Nov 1 2022, 3:44 AM.

Details

Summary

A nullptr dereference happens in DIFile when Source is non-null, but
*Source is null, as only Source is checked. The crash happens when
using embedded DWARF-5 debugging info in combination with the GDB
JIT event listener to debug JIT-compiled code within cling/ROOT.

Diff Detail

Event Timeline

amadio created this revision.Nov 1 2022, 3:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 1 2022, 3:44 AM
amadio requested review of this revision.Nov 1 2022, 3:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 1 2022, 3:44 AM
amadio updated this revision to Diff 472288.Nov 1 2022, 6:59 AM

Updated due to clang-format failure.

This LGTM but I'd like to add reviewers who changed this area recently.

Any chance of a test case? (unit test using the JIT event listener directly, perhaps?)

As far as I could tell with some testing, this crash happens if you pass in an empty string because then getCanonicalMDString() returns a nullptr. I think it would be cleaner to normalize this case to None: https://reviews.llvm.org/D138658

Thanks for looking into this. I'm going to close this in favor of D138658. We should revert my change in ROOT and apply your patch instead.

amadio abandoned this revision.Nov 24 2022, 5:10 AM