mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-29 17:42:01 +00:00
bulk code format fix (#8707)
This commit is contained in:
@@ -44,7 +44,6 @@ public struct Verifier {
|
||||
storage.tableCount
|
||||
}
|
||||
|
||||
|
||||
/// Initializer for the verifier
|
||||
/// - Parameters:
|
||||
/// - buffer: Bytebuffer that is required to be verified
|
||||
@@ -54,8 +53,8 @@ public struct Verifier {
|
||||
public init(
|
||||
buffer: inout ByteBuffer,
|
||||
options: VerifierOptions = .init(),
|
||||
checkAlignment: Bool = true) throws
|
||||
{
|
||||
checkAlignment: Bool = true
|
||||
) throws {
|
||||
guard buffer.capacity < FlatBufferMaxSize else {
|
||||
throw FlatbuffersErrors.exceedsMaxSizeAllowed
|
||||
}
|
||||
@@ -186,17 +185,21 @@ public struct Verifier {
|
||||
|
||||
let reportedOverflow: (partialValue: UInt32, overflow: Bool)
|
||||
if offset > 0 {
|
||||
reportedOverflow = _int32Position
|
||||
reportedOverflow =
|
||||
_int32Position
|
||||
.subtractingReportingOverflow(offset.magnitude)
|
||||
} else {
|
||||
reportedOverflow = _int32Position
|
||||
reportedOverflow =
|
||||
_int32Position
|
||||
.addingReportingOverflow(offset.magnitude)
|
||||
}
|
||||
|
||||
/// since `subtractingReportingOverflow` & `addingReportingOverflow` returns true,
|
||||
/// if there is overflow we return failure
|
||||
if reportedOverflow.overflow || reportedOverflow.partialValue > _buffer
|
||||
.capacity
|
||||
if reportedOverflow.overflow
|
||||
|| reportedOverflow.partialValue
|
||||
> _buffer
|
||||
.capacity
|
||||
{
|
||||
throw FlatbuffersErrors.signedOffsetOutOfBounds(
|
||||
offset: Int(offset),
|
||||
|
||||
Reference in New Issue
Block a user