[FFmpeg-devel] [PATCH] fix vorbis decoder amplitude bits handling
Alex Converse
alex.converse
Thu Nov 18 08:11:38 CET 2010
On Tue, Nov 16, 2010 at 2:42 AM, Yuriy Kaminskiy <yumkam at mail.ru> wrote:
>
> Baptiste Coudurier wrote:
> > Hi
> >
> > $subject. Please comment.
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > Index: libavcodec/vorbis_dec.c
> > ===================================================================
> > --- libavcodec/vorbis_dec.c ? (revision 25756)
> > +++ libavcodec/vorbis_dec.c ? (working copy)
> > @@ -563,6 +563,11 @@
> > ? ? ? ? ? ? ? ? ? ? ? "Floor 0 amplitude bits is 0.\n");
> > ? ? ? ? ? ? ? ?return -1;
> > ? ? ? ? ? ? ?}
> > + ? ? ? ? ? ?if (floor_setup->data.t0.amplitude_bits > 32) {
> Not enough, s/>/>=/, result of 1<<32 is undefined (and I'm sure code below
> really broken on x86 when amplitude_bits == 32, resulting in divide-by-zero):
> === cut ===
> ? ? ? ? ? ? ? ? ? ?q = exp((((amplitude*vf->amplitude_offset) /
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(((1 << vf->amplitude_bits) - 1) * sqrt(p + q)))
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? - vf->amplitude_offset) * .11512925f);
> === cut ===
>
Libvorbis does that. When in Rome...
More information about the ffmpeg-devel
mailing list