mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2025-01-18 12:02:10 +01:00
Added missing varint size check
This commit is contained in:
parent
cbc0a05341
commit
b630d1d205
@ -18,8 +18,9 @@ static bool varint(CTX &ctx, T &val)
|
|||||||
{
|
{
|
||||||
val = 0;
|
val = 0;
|
||||||
uint shift = 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;
|
val |= ((quint8)*ctx.bp & 0x7F) << shift;
|
||||||
shift += 7;
|
shift += 7;
|
||||||
if (!((quint8)*ctx.bp++ & 0x80))
|
if (!((quint8)*ctx.bp++ & 0x80))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user