Skip to content
This repository has been archived by the owner on Nov 16, 2020. It is now read-only.

Commit

Permalink
Fix the assert condition.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMage committed May 2, 2019
1 parent 667862a commit 8a72c33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/TemplateKit/Utilities/HTMLEscape.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ extension String {
let end = raw + expectedLength
for character in self.utf8 {
var escaped = String.htmlEscapeMapASCIIByteArray[Int(character)]
assert(raw + escaped.count < end)
assert(raw + escaped.count <= end)
raw.copyMemory(from: &escaped, byteCount: escaped.count)
raw += escaped.count
}
Expand All @@ -81,7 +81,7 @@ extension String {
writeEscapedString(resultBytes)

// Note: Byte 16 should always be zero to make sure the string is null-terminated.
// This is ensured by `raw + escaped.count < end = expectedLength <= 15` above.
// This is ensured by `raw + escaped.count <= end = expectedLength <= 15` above.
return String(cString: resultBytes.assumingMemoryBound(to: UInt8.self))
} else {
var resultData = Array<UInt8>(repeating: 0, count: expectedLength)
Expand Down

0 comments on commit 8a72c33

Please sign in to comment.