Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
flatbuffers
Commits
a1d801c3
Commit
a1d801c3
authored
Jul 13, 2015
by
Frank Stein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2Gb buffer size checks fixed for Python Builder
parent
4798456d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
builder.py
python/flatbuffers/builder.py
+8
-2
No files found.
python/flatbuffers/builder.py
View file @
a1d801c3
...
...
@@ -93,7 +93,7 @@ class Builder(object):
The internal buffer is grown as needed.
"""
if
not
(
0
<=
initialSize
<
(
2
**
UOffsetTFlags
.
bytewidth
-
1
)):
if
not
(
0
<=
initialSize
<
=
self
.
MaxBufferSize
(
)):
msg
=
"flatbuffers: Cannot create Builder larger than 2 gigabytes."
raise
BuilderSizeError
(
msg
)
...
...
@@ -104,6 +104,12 @@ class Builder(object):
self
.
objectEnd
=
None
self
.
vtables
=
[]
def
MaxBufferSize
(
self
):
"""
Maximum buffer size is 2Gb.
"""
return
2
**
31
def
Output
(
self
):
"""
Output returns the portion of the buffer that has been used for
...
...
@@ -238,7 +244,7 @@ class Builder(object):
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
)
<=
2
**
20
:
if
not
len
(
self
.
Bytes
)
<=
self
.
MaxBufferSize
()
:
msg
=
"flatbuffers: cannot grow buffer beyond 2 gigabytes"
raise
BuilderSizeError
(
msg
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment