Skip to content

Commit 52c32c5

Browse files
authored
Merge pull request #68187 from al45tair/eng/PR-114447171
[Demangling] Avoid UB call to memcpy().
2 parents 720e423 + cd19886 commit 52c32c5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/swift/Demangling/Demangler.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ class NodeFactory {
206206
if (Growth < Capacity * 2)
207207
Growth = Capacity * 2;
208208
T *NewObjects = Allocate<T>(Capacity + Growth);
209-
memcpy(NewObjects, Objects, OldAllocSize);
209+
if (OldAllocSize)
210+
memcpy(NewObjects, Objects, OldAllocSize);
210211
Objects = NewObjects;
211212
Capacity += Growth;
212213
}

0 commit comments

Comments
 (0)