diff --git a/libclamav/aspack.c b/libclamav/aspack.c index c487b3f5fc..ec94c074d9 100644 --- a/libclamav/aspack.c +++ b/libclamav/aspack.c @@ -286,7 +286,10 @@ static int decrypt(struct ASPK *stream, uint8_t *stuff, uint32_t size, uint8_t * if (!build_decrypt_dictionaries(stream)) return 0; continue; } - if ((backbytes = (gen - 256) >> 3) >= 58) return 0; /* checks init_array + stuff */ + backbytes = (gen - 256) >> 3; + // backbytes is < 720. 719 - 256 = 463. 463 >> 3 = 57 (max). + // So backbytes cannot overrun the init_array. + backsize = ((gen - 256) & 7) + 2; if ((backsize - 2) == 7) { uint8_t hlp;