Skip to content

Commit 5034dc6

Browse files
authored
Merge pull request swiftlang#9882 from eeckstein/fix-demangler-hang
2 parents 45e5116 + e8ce388 commit 5034dc6

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/Demangling/Demangler.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,10 @@ NodePointer Demangler::demangleMultiSubstitutions() {
442442
int RepeatCount = -1;
443443
while (true) {
444444
char c = nextChar();
445+
if (c == 0) {
446+
// End of text.
447+
return nullptr;
448+
}
445449
if (isLowerLetter(c)) {
446450
// It's a substitution with an index < 26.
447451
NodePointer Nd = pushMultiSubstitutions(RepeatCount, c - 'a');

test/Demangle/Inputs/manglings.txt

+1
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,5 @@ _T08_ElementQzSbs5Error_pIxxdzo_ABSbsAC_pIxidzo_s26RangeReplaceableCollectionRzA
256256
_T0Ix_IyB_Tr ---> {T:} reabstraction thunk from @callee_owned () -> () to @callee_unowned @convention(block) () -> ()
257257
_T0Rml ---> _T0Rml
258258
_T0Tk ---> _T0Tk
259+
_T0A8 ---> _T0A8
259260

0 commit comments

Comments
 (0)