Commit 33e4ab65 authored by Frank Stein's avatar Frank Stein

Incorrect buffer size check fixed.

parent 7bcbb195
...@@ -245,11 +245,11 @@ class Builder(object): ...@@ -245,11 +245,11 @@ class Builder(object):
def growByteBuffer(self): def growByteBuffer(self):
"""Doubles the size of the byteslice, and copies the old data towards """Doubles the size of the byteslice, and copies the old data towards
the end of the new buffer (since we build the buffer backwards).""" 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" msg = "flatbuffers: cannot grow buffer beyond 2 gigabytes"
raise BuilderSizeError(msg) 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: if newSize == 0:
newSize = 1 newSize = 1
bytes2 = bytearray(newSize) bytes2 = bytearray(newSize)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment