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
36c5780a
Unverified
Commit
36c5780a
authored
Jun 18, 2018
by
Feng Xiao
Committed by
GitHub
Jun 18, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4739 from asimshankar/tf-bytesize
Graceful failure in SerializeToArray().
parents
b40cb4bc
2020e3d5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
message_lite.cc
src/google/protobuf/message_lite.cc
+5
-1
No files found.
src/google/protobuf/message_lite.cc
View file @
36c5780a
...
...
@@ -316,7 +316,11 @@ bool MessageLite::SerializeToArray(void* data, int size) const {
}
bool
MessageLite
::
SerializePartialToArray
(
void
*
data
,
int
size
)
const
{
int
byte_size
=
ByteSizeLong
();
size_t
byte_size
=
ByteSizeLong
();
if
(
byte_size
>
INT_MAX
)
{
GOOGLE_LOG
(
ERROR
)
<<
"Exceeded maximum protobuf size of 2GB: "
<<
size
;
return
false
;
}
if
(
size
<
byte_size
)
return
false
;
uint8
*
start
=
reinterpret_cast
<
uint8
*>
(
data
);
uint8
*
end
=
SerializeWithCachedSizesToArray
(
start
);
...
...
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