[Ffmpeg-devel] [BUG] vorbis decoder

Måns Rullgård mru
Thu May 11 02:40:12 CEST 2006

Mike Melanson <mike at multimedia.cx> writes:

> Benjamin Larsson wrote:
>> Benjamin Larsson wrote:
>>>This file seams to segfault the vorbis decoder.
>>>Benjamin Larsson
>> Loren fixed it.
> With this fix?
> - floor_setup->data.t1.subclass_books[j][k]=get_bits(gb, 8)-1;
> + floor_setup->data.t1.subclass_books[j][k]=(int16_t)get_bits(gb, 8)-1;
> I would just like to point out that I can't understand (big surprise
> there) why this change makes a difference.

get_bits() returns unsigned int, typically 32 bits.
subclass_books[][] is declared as int_fast16_t, which is typedef long
on 64-bit hardware.  The explicit cast to signed 16-bit will make the
value properly sign extended.  On 32-bit hardware int_fast16_t is 32
bits, so there is nothing to extend.

M?ns Rullg?rd
mru at inprovide.com

More information about the ffmpeg-devel mailing list