llvm.org GIT mirror llvm / 61d2657
llvm-undname: Fix a crash-on-invalid Found by oss-fuzz, fixes issues 12435 and 12438 on oss-fuzz. Differential Revision: https://reviews.llvm.org/D60202 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357646 91177308-0d34-0410-b5e6-96231b3b80d8 Nico Weber 1 year, 7 months ago
2 changed file(s) with 10 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
12751275 return nullptr;
12761276 }
12771277
1278 // Returns MangledName's prefix before the first '@', or an error if
1279 // MangledName contains no '@' or the prefix has length 0.
12781280 StringView Demangler::demangleSimpleString(StringView &MangledName,
12791281 bool Memorize) {
12801282 StringView S;
12811283 for (size_t i = 0; i < MangledName.size(); ++i) {
12821284 if (MangledName[i] != '@')
12831285 continue;
1286 if (i == 0)
1287 break;
12841288 S = MangledName.substr(0, i);
12851289 MangledName = MangledName.dropFront(i + 1);
12861290
77 ?f0@@YAXPEU?$AS_@$00$$CAD@__clang@@@Z
88 ; CHECK-EMPTY:
99 ; CHECK-NEXT: ?f0@@YAXPEU?$AS_@$00$$CAD@__clang@@@Z
10 ; CHECK-NEXT: error: Invalid mangled name
10 ; CHECK-NEXT: error: Invalid mangled name
11
12 ?@@8
13 ; CHECK-EMPTY:
14 ; CHECK-NEXT: ?@@8
15 ; CHECK-NEXT: error: Invalid mangled name