Skip to content

Commit cab7f94

Browse files
authored
Merge pull request #34321 from vedantk/fix-ubsan-issue
2 parents 8b170f9 + 7145afb commit cab7f94

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/swift/Demangling/Demangler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class NodeFactory {
140140
#endif
141141

142142
// Do we have enough space in the current slab?
143-
if (CurPtr + ObjectSize > End) {
143+
if (!CurPtr || CurPtr + ObjectSize > End) {
144144
// No. We have to malloc a new slab.
145145
// We double the slab size for each allocated slab.
146146
SlabSize = std::max(SlabSize * 2, ObjectSize + alignof(T));

0 commit comments

Comments
 (0)