diff --git a/engine/common/soundlib/libmpg/getbits.h b/engine/common/soundlib/libmpg/getbits.h index 350d5ab1..a4e5f165 100644 --- a/engine/common/soundlib/libmpg/getbits.h +++ b/engine/common/soundlib/libmpg/getbits.h @@ -47,6 +47,10 @@ static uint getbits( mpg123_handle_t *fr, int number_of_bits ) { ulong rval; + if( (long)(fr->wordpointer-fr->bsbuf)*8 + + fr->bitindex+number_of_bits > (long)fr->framesize*8 ) + return 0; + rval = fr->wordpointer[0]; rval <<= 8; rval |= fr->wordpointer[1];