mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-18 01:06:31 +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:
@@ -63,6 +63,17 @@ final class FlatbuffersVerifierTests: XCTestCase {
|
||||
XCTAssertThrowsError(try Verifier(buffer: &buffer))
|
||||
}
|
||||
|
||||
func testFailingID() {
|
||||
let dutData : [UInt8] = [1,2,3,4,5,6,7]
|
||||
var buff = ByteBuffer(bytes: dutData)
|
||||
do {
|
||||
let _: Monster = try getCheckedRoot(byteBuffer: &buff, fileId: "ABCD")
|
||||
XCTFail("This should always fail")
|
||||
} catch {
|
||||
XCTAssertEqual(error as? FlatbuffersErrors, .bufferDoesntContainID)
|
||||
}
|
||||
}
|
||||
|
||||
func testVerifierCheckAlignment() {
|
||||
var verifier = try! Verifier(buffer: &buffer)
|
||||
do {
|
||||
|
||||
Reference in New Issue
Block a user