Skip to content

Commit

Permalink
initial hardening - guarding for index overflows
Browse files Browse the repository at this point in the history
  • Loading branch information
tannerdsilva committed Mar 18, 2024
1 parent dd36634 commit 08131bd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Sources/HummingbirdCore/Utils/HBParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,9 @@ extension Parser {
while index < original.endIndex {
// if we have found a percent sign
if original[index] == 0x25 {
guard original.endIndex - index >= 2 else {
throw DecodeError()
}
let high = Self.asciiHexValues[Int(original[index + 1])]
let low = Self.asciiHexValues[Int(original[index + 2])]
index += 3
Expand Down

0 comments on commit 08131bd

Please sign in to comment.