Fixed invalid access in wavpack decoder on corrupted extra bits sub-blocks.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit beefafda639dd53fc59c21d8a7cf8334da9a1062)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
This commit is contained in:
Laurent Aimar 2011-09-07 23:12:32 +02:00 committed by Reinhard Tartler
parent 4ccb8f5b7b
commit 9864518544

View File

@ -368,7 +368,7 @@ static inline int wv_get_value_integer(WavpackContext *s, uint32_t *crc, int S)
if(s->extra_bits){
S <<= s->extra_bits;
if(s->got_extra_bits){
if(s->got_extra_bits && get_bits_left(&s->gb_extra_bits) >= s->extra_bits){
S |= get_bits(&s->gb_extra_bits, s->extra_bits);
*crc = *crc * 9 + (S&0xffff) * 3 + ((unsigned)S>>16);
}