aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Feng Xiao <xiaofeng@google.com>2015-09-24 17:41:45 -0700
committerGravatar Feng Xiao <xiaofeng@google.com>2015-09-24 17:41:45 -0700
commit0e5686a70768a289782eb1e1aa86646e56897e4d (patch)
tree07c1ee3c3b04b19abbde2e7fd5dec5c2d8cfff11 /src
parent97a1c1e08d87ca8c669418a6c46d605d3d602497 (diff)
parentad1d726cc28e783495e7d11c73c49a7502400a89 (diff)
Merge pull request #727 from AustinSchuh/arena_bounds_fix
Handled blocks being too small in arena.cc
Diffstat (limited to 'src')
-rwxr-xr-xsrc/google/protobuf/arena.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/google/protobuf/arena.cc b/src/google/protobuf/arena.cc
index 907a6a20..2d66dfd7 100755
--- a/src/google/protobuf/arena.cc
+++ b/src/google/protobuf/arena.cc
@@ -61,6 +61,9 @@ void Arena::Init() {
cleanup_list_ = 0;
if (options_.initial_block != NULL && options_.initial_block_size > 0) {
+ GOOGLE_CHECK_GE(options_.initial_block_size, sizeof(Block))
+ << ": Initial block size too small for header.";
+
// Add first unowned block to list.
Block* first_block = reinterpret_cast<Block*>(options_.initial_block);
first_block->size = options_.initial_block_size;