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 f4db00f + 45f0961 commit c5e9e42Copy full SHA for c5e9e42
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