Skip to content

Commit 8461427

Browse files
committed
[ASTGen] Fix off-by-one error in allocation of UTF-8 string for buffer use
The semantics of llvm::MemoryBuffer and NULL termination are... subtle.
1 parent b29d467 commit 8461427

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/ASTGen/Sources/ASTGen/Macros.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private func allocateUTF8String(
7777
ptr[utf8.count] = 0
7878
}
7979

80-
return (UnsafePointer<UInt8>(ptr), capacity)
80+
return (UnsafePointer<UInt8>(ptr), utf8.count)
8181
}
8282
}
8383

0 commit comments

Comments
 (0)