This is an archive of the discontinued LLVM Phabricator instance.

[obj2yaml] - Fix the crash in getUniquedSectionName().
ClosedPublic

Authored by grimar on Dec 23 2020, 3:01 AM.

Details

Summary

getUniquedSectionName(const Elf_Shdr *Sec) assumes that
Sec is not nullptr.

I've found one place in getUniquedSymbolName where it is
not true (because of that we crash when trying to dump
unnamed null section symbols).

Patch fixes the crash and changes the signature of the
getUniquedSectionName section to accept a reference.

Diff Detail

Event Timeline

grimar created this revision.Dec 23 2020, 3:01 AM
grimar requested review of this revision.Dec 23 2020, 3:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 23 2020, 3:01 AM
jhenderson accepted this revision.Jan 5 2021, 1:37 AM

LGTM.

llvm/tools/obj2yaml/elf2yaml.cpp
120

Seems to me like this assert is rather unnecessary? That's just saying that the previous line's calculation is correct.

This revision is now accepted and ready to land.Jan 5 2021, 1:37 AM
MaskRay accepted this revision.Jan 5 2021, 10:29 AM
grimar marked an inline comment as done.Jan 11 2021, 3:49 AM
grimar added inline comments.
llvm/tools/obj2yaml/elf2yaml.cpp
120

Yeah. I'll remove it before committing.

This revision was automatically updated to reflect the committed changes.
grimar marked an inline comment as done.