Skip to content

Commit df9ae88

Browse files
committed
[ASTGen]: assert that position is within buffer bounds
1 parent b0d3234 commit df9ae88

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/ASTGen/Sources/ASTGen/Bridge.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ extension BridgedSourceLoc {
3434
) {
3535
if let start = buffer.baseAddress,
3636
position.utf8Offset >= 0 && position.utf8Offset < buffer.count {
37+
assert(position.utf8Offset >= 0 && position.utf8Offset < buffer.count)
3738
self = SourceLoc_advanced(BridgedSourceLoc(raw: start), SwiftInt(position.utf8Offset))
3839
} else {
3940
self = nil

0 commit comments

Comments
 (0)