mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-02 12:08:17 +00:00
(fix): #8408 fixes a bug where the capacity of the buffer isnt verified before trying to verify the ID (#8413)
This commit is contained in:
@@ -201,8 +201,12 @@ public struct Verifier {
|
||||
_depth -= 1
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
mutating func verify(id: String) throws {
|
||||
let size = MemoryLayout<Int32>.size
|
||||
guard _capacity >= (size * 2) else {
|
||||
throw FlatbuffersErrors.bufferDoesntContainID
|
||||
}
|
||||
let str = _buffer.readString(at: size, count: size)
|
||||
if id == str {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user