[PATCH] D60354: llvm-undname: Fix more crashes and asserts on invalid inputs
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 8 12:14:37 PDT 2019
thakis added inline comments.
================
Comment at: llvm/lib/Demangle/MicrosoftDemangle.cpp:722-724
+ if (Symbol) {
+ Symbol->Name = QN;
+ }
----------------
zturner wrote:
> How about
> ```
> if (Error)
> return nullptr;
>
> assert(Symbol);
> Symbol->Name = QN;
> ```
That's fine too. I just moved this code around though, see line 732 on the lhs.
================
Comment at: llvm/lib/Demangle/MicrosoftDemangle.cpp:1955
+ // Safe because this is only called if isMemberPointer() returns true, which
+ // guarantess there's at least one more character after the qualifiers.
if (MangledName.consumeFront("8")) {
----------------
zturner wrote:
> s/guarantess/guarantees/
>
> That said, I would just change this to:
>
> ```
> // isMemberPointer() only returns true if there is at least one character after the qualifiers.
> assert(!MangledName.empty());
> ```
Thanks, that's better.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60354/new/
https://reviews.llvm.org/D60354
More information about the llvm-commits
mailing list