Skip to content

Commit 33e4ab6

Browse files
committed
Incorrect buffer size check fixed.
1 parent 7bcbb19 commit 33e4ab6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎python/flatbuffers/builder.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,11 @@ def EndObject(self):
245245
def growByteBuffer(self):
246246
"""Doubles the size of the byteslice, and copies the old data towards
247247
the end of the new buffer (since we build the buffer backwards)."""
248-
if not len(self.Bytes) <= Builder.MAX_BUFFER_SIZE:
248+
if len(self.Bytes) == Builder.MAX_BUFFER_SIZE:
249249
msg = "flatbuffers: cannot grow buffer beyond 2 gigabytes"
250250
raise BuilderSizeError(msg)
251251

252-
newSize = min( len(self.Bytes) * 2, Builder.MAX_BUFFER_SIZE )
252+
newSize = min(len(self.Bytes) * 2, Builder.MAX_BUFFER_SIZE)
253253
if newSize == 0:
254254
newSize = 1
255255
bytes2 = bytearray(newSize)

0 commit comments

Comments
 (0)