aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bunzip.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/bunzip.c b/lib/bunzip.c
index 5c3b842b..01daa783 100644
--- a/lib/bunzip.c
+++ b/lib/bunzip.c
@@ -197,7 +197,9 @@ int read_bunzip_data(bunzip_data *bd)
t = get_bits(bd, 5);
for (i = 0; i < symCount; i++) {
for(;;) {
- if (MAX_HUFCODE_BITS < (unsigned)t-1) return RETVAL_DATA_ERROR;
+ // !t || t > MAX_HUFCODE_BITS in one test.
+ if (MAX_HUFCODE_BITS-1 < (unsigned)t-1)
+ return RETVAL_DATA_ERROR;
if(!get_bits(bd, 1)) break; // Stop yet?
t += (1 - 2*get_bits(bd, 1)); // bit ? t-- : t++
}