Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
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
protobuf
Commits
c40f8c1f
Commit
c40f8c1f
authored
Feb 18, 2016
by
Joshua Haberman
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1229 from keveman/unlimited_binary_proto
Added ALLOW_UNLIMITED_BINARY_PROTO macro and setting it when
parents
61e8e218
99a3e30b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
BUILD
BUILD
+12
-2
message.cc
python/google/protobuf/pyext/message.cc
+9
-0
No files found.
BUILD
View file @
c40f8c1f
...
...
@@ -462,7 +462,7 @@ genrule(
name = "gen_well_known_protos_java",
srcs = WELL_KNOWN_PROTOS,
outs = [
"wellknown.srcjar"
"wellknown.srcjar"
,
],
cmd = "$(location :protoc) --java_out=$(@D)/wellknown.jar" +
" -Isrc $(SRCS) " +
...
...
@@ -539,7 +539,10 @@ cc_binary(
]),
copts = COPTS + [
"-DGOOGLE_PROTOBUF_HAS_ONEOF=1",
],
] + select({
"//conditions:default": [],
":allow_oversize_protos": ["-DPROTOBUF_PYTHON_ALLOW_OVERSIZE_PROTOS=1"],
}),
includes = [
"python/",
"src/",
...
...
@@ -561,6 +564,13 @@ config_setting(
},
)
config_setting(
name = "allow_oversize_protos",
values = {
"define": "allow_oversize_protos=true",
},
)
py_proto_library(
name = "protobuf_python",
srcs = WELL_KNOWN_PROTOS,
...
...
python/google/protobuf/pyext/message.cc
View file @
c40f8c1f
...
...
@@ -1921,6 +1921,15 @@ static PyObject* MergeFromString(CMessage* self, PyObject* arg) {
AssureWritable
(
self
);
io
::
CodedInputStream
input
(
reinterpret_cast
<
const
uint8
*>
(
data
),
data_length
);
#if PROTOBUF_PYTHON_ALLOW_OVERSIZE_PROTOS
// Protobuf has a 64MB limit built in, this code will override this. Please do
// not enable this unless you fully understand the implications: protobufs
// must all be kept in memory at the same time, so if they grow too big you
// may get OOM errors. The protobuf APIs do not provide any tools for
// processing protobufs in chunks. If you have protos this big you should
// break them up if it is at all convenient to do so.
input
.
SetTotalBytesLimit
(
INT_MAX
,
INT_MAX
);
#endif // PROTOBUF_PYTHON_ALLOW_OVERSIZE_PROTOS
PyDescriptorPool
*
pool
=
GetDescriptorPoolForMessage
(
self
);
input
.
SetExtensionRegistry
(
pool
->
pool
,
pool
->
message_factory
);
bool
success
=
self
->
message
->
MergePartialFromCodedStream
(
&
input
);
...
...
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