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.
1 parent 923dc44 commit 45f0961Copy full SHA for 45f0961
src/serialize.h
@@ -336,11 +336,18 @@ I ReadVarInt(Stream& is)
336
I n = 0;
337
while(true) {
338
unsigned char chData = ser_readdata8(is);
339
+ if (n > (std::numeric_limits<I>::max() >> 7)) {
340
+ throw std::ios_base::failure("ReadVarInt(): size too large");
341
+ }
342
n = (n << 7) | (chData & 0x7F);
- if (chData & 0x80)
343
+ if (chData & 0x80) {
344
+ if (n == std::numeric_limits<I>::max()) {
345
346
347
n++;
- else
348
+ } else {
349
return n;
350
351
}
352
353
0 commit comments