This is an archive of the discontinued LLVM Phabricator instance.

[libcxxabi][demangler] Fix a exponential string copying bug
ClosedPublic

Authored by erik.pilkington on May 28 2017, 2:27 PM.

Details

Summary

The problem was that if base_name() was called from a context without an actual base name, it could gulp up the entire string, which can result in recursive duplications. The fix is to be more strict as to what qualifies as a base name.

Fixes PR31031
Thanks

Diff Detail

Repository
rL LLVM

Event Timeline

erik.pilkington edited reviewers, added: compnerd; removed: EricWF.May 28 2017, 2:28 PM
erik.pilkington added a subscriber: cfe-commits.
compnerd accepted this revision.May 28 2017, 3:17 PM

Thanks for looking into this, its been on my list for a while now.

src/cxa_demangle.cpp
2918 ↗(On Diff #100568)

Hmm, I wonder if we should negate and hoist this into the condition rather than the explicit check here. It makes it slightly more obvious what we are trying to do here. However, it does make failing more challenging (since we cannot as easily identify if the extraction failed.

This revision is now accepted and ready to land.May 28 2017, 3:17 PM
This revision was automatically updated to reflect the committed changes.