We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents bf8c830 + 7e59777 commit a84f444Copy full SHA for a84f444
include/msgpack/unpack.hpp
@@ -1262,7 +1262,12 @@ inline void unpacker::expand_buffer(std::size_t size)
1262
std::size_t next_size = m_initial_buffer_size; // include COUNTER_SIZE
1263
std::size_t not_parsed = m_used - m_off;
1264
while(next_size < size + not_parsed + COUNTER_SIZE) {
1265
- next_size *= 2;
+ std::size_t tmp_next_size = next_size * 2;
1266
+ if (tmp_next_size <= next_size) {
1267
+ next_size = size + not_parsed + COUNTER_SIZE;
1268
+ break;
1269
+ }
1270
+ next_size = tmp_next_size;
1271
}
1272
1273
char* tmp = static_cast<char*>(::malloc(next_size));
0 commit comments