Skip to content

Commit 59c7dd2

Browse files
committed
Added missing varint overflow check
1 parent 720be4b commit 59c7dd2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/data.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static bool varint(CTX &ctx, T &val)
3030
unsigned int shift = 0;
3131
val = 0;
3232

33-
while (ctx.bp < ctx.be) {
33+
while ((ctx.bp < ctx.be) && (shift < sizeof(T) * 7)) {
3434
val |= static_cast<T>((quint8)*ctx.bp & 0x7F) << shift;
3535
shift += 7;
3636
if (!((quint8)*ctx.bp++ & 0x80))

0 commit comments

Comments
 (0)