From b630d1d205b3478f36439a63ed1959b23fd58313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Mon, 6 Jan 2025 09:44:53 +0100 Subject: [PATCH] Added missing varint size check --- src/data.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/data.cpp b/src/data.cpp index 565eef7..737b818 100644 --- a/src/data.cpp +++ b/src/data.cpp @@ -18,8 +18,9 @@ static bool varint(CTX &ctx, T &val) { val = 0; uint shift = 0; + const char *end = qMin(ctx.be, ctx.bp + sizeof(val)); - while (ctx.bp < ctx.be) { + while (ctx.bp < end) { val |= ((quint8)*ctx.bp & 0x7F) << shift; shift += 7; if (!((quint8)*ctx.bp++ & 0x80))