diff --git a/apps/codecs/libwma/bitstream.c b/apps/codecs/libwma/bitstream.c index 4c4ab232ff..9e3d1863a2 100644 --- a/apps/codecs/libwma/bitstream.c +++ b/apps/codecs/libwma/bitstream.c @@ -106,6 +106,8 @@ static int alloc_table(VLC *vlc, int size) index = vlc->table_size; vlc->table_size += size; if (vlc->table_size > vlc->table_allocated) { + DEBUGF("Tried to allocate past the end of a Huffman table: %d/%d\n", + vlc->table_allocated, vlc->table_allocated+(1 << vlc->bits)); vlc->table_allocated += (1 << vlc->bits); if (!vlc->table) return -1; diff --git a/apps/codecs/libwma/wmadeci.c b/apps/codecs/libwma/wmadeci.c index e67a9dcbeb..cba518024f 100644 --- a/apps/codecs/libwma/wmadeci.c +++ b/apps/codecs/libwma/wmadeci.c @@ -663,6 +663,7 @@ int wma_decode_init(WMADecodeContext* s, asf_waveformatex_t *wfx) #endif s->hgain_vlc.table = vlcbuf4; + s->hgain_vlc.table_allocated = VLCBUF4SIZE; init_vlc(&s->hgain_vlc, HGAINVLCBITS, sizeof(hgain_huffbits), hgain_huffbits, 1, 1, hgain_huffcodes, 2, 2, 0); @@ -672,6 +673,7 @@ int wma_decode_init(WMADecodeContext* s, asf_waveformatex_t *wfx) { s->exp_vlc.table = vlcbuf3; + s->exp_vlc.table_allocated = VLCBUF3SIZE; init_vlc(&s->exp_vlc, EXPVLCBITS, sizeof(scale_huffbits), scale_huffbits, 1, 1,