mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-26 10:02:40 +00:00
[Swift] Fix padding function overflow when bufSize is 0 (#5721)
* [Swift] Fix padding function overflow when bufSize is 0 [Swift] Generate linuxmain * [Swift] Using the overflow addition operator to resolve integer overflow
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
bab2b0db48
commit
7cdfc8475e
@@ -219,7 +219,7 @@ extension FlatBufferBuilder {
|
||||
/// - bufSize: Current size of the buffer + the offset of the object to be written
|
||||
/// - elementSize: Element size
|
||||
fileprivate func padding(bufSize: UInt32, elementSize: UInt32) -> UInt32 {
|
||||
((~bufSize) + 1) & (elementSize - 1)
|
||||
((~bufSize) &+ 1) & (elementSize - 1)
|
||||
}
|
||||
|
||||
/// Prealigns the buffer before writting a new object into the buffer
|
||||
|
||||
Reference in New Issue
Block a user