From 2a35b00d16d1be5a8a757ec707b744d5c705eb31 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Mon, 19 Aug 2013 11:18:50 +0200 Subject: [PATCH] Adds extra checks when decoding binary integers. --- util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util.c b/util.c index 320d251f..a5c963e4 100644 --- a/util.c +++ b/util.c @@ -522,6 +522,8 @@ loop: if ((b & 0x80) == 0) { v |= (uint32_t)b << s; s += 7; + if (s >= 32) + return -1; goto loop; } @@ -550,6 +552,8 @@ loop: if ((b & 0x80) == 0) { v |= (uint64_t)b << s; s += 7; + if (s >= 64) + return -1; goto loop; }