llvm.org GIT mirror llvm / 61c3815
llvm-undname: Fix two asserts-on-invalid git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358707 91177308-0d34-0410-b5e6-96231b3b80d8 Nico Weber 1 year, 7 months ago
2 changed file(s) with 15 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
837837 // ::= [?]
838838 //
839839 // ::= # when 1 <= Number <= 10
840 // ::= + @ # when Numbrer == 0 or >= 10
840 // ::= + @ # when Number == 0 or >= 10
841841 //
842842 // ::= [A-P] # A = 0, B = 1, ...
843843 std::pair Demangler::demangleNumber(StringView &MangledName) {
12681268 Result->IsTruncated = true;
12691269
12701270 while (!MangledName.consumeFront('@')) {
1271 assert(StringByteSize >= 2);
1271 if (StringByteSize < 2)
1272 goto StringLiteralError;
12721273 wchar_t W = demangleWcharLiteral(MangledName);
12731274 if (StringByteSize != 2 || Result->IsTruncated)
12741275 outputEscapedChar(OS, W);
12841285
12851286 unsigned BytesDecoded = 0;
12861287 while (!MangledName.consumeFront('@')) {
1287 assert(StringByteSize >= 1);
1288 if (StringByteSize < 1)
1289 goto StringLiteralError;
12881290 StringBytes[BytesDecoded++] = demangleCharLiteral(MangledName);
12891291 }
12901292
138138 ; CHECK-EMPTY:
139139 ; CHECK-NEXT: ?foo@?$?0H@
140140 ; CHECK-NEXT: error: Invalid mangled name
141
142 ??_C@_0A@01234567@a
143 ; CHECK-EMPTY:
144 ; CHECK-NEXT: ??_C@_0A@01234567@a
145 ; CHECK-NEXT: error: Invalid mangled name
146
147 ??_C@_1A@01234567@a
148 ; CHECK-EMPTY:
149 ; CHECK-NEXT: ??_C@_1A@01234567@a
150 ; CHECK-NEXT: error: Invalid mangled name