Skip to content

Commit

Permalink
Incorrect buffer size check fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankStain committed Aug 13, 2015
1 parent 7bcbb19 commit 33e4ab6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/flatbuffers/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,11 @@ def EndObject(self):
def growByteBuffer(self):
"""Doubles the size of the byteslice, and copies the old data towards
the end of the new buffer (since we build the buffer backwards)."""
if not len(self.Bytes) <= Builder.MAX_BUFFER_SIZE:
if len(self.Bytes) == Builder.MAX_BUFFER_SIZE:
msg = "flatbuffers: cannot grow buffer beyond 2 gigabytes"
raise BuilderSizeError(msg)

newSize = min( len(self.Bytes) * 2, Builder.MAX_BUFFER_SIZE )
newSize = min(len(self.Bytes) * 2, Builder.MAX_BUFFER_SIZE)
if newSize == 0:
newSize = 1
bytes2 = bytearray(newSize)
Expand Down

0 comments on commit 33e4ab6

Please sign in to comment.