[FFmpeg-devel] [PATCH 1/4] avcodec/mpc8: Fixes invalid shift in mpc8_decode_frame()

Michael Niedermayer michael at niedermayer.cc
Sat Jul 13 15:28:09 EEST 2019


On Thu, Jul 11, 2019 at 07:37:15PM -0300, James Almer wrote:
> On 7/11/2019 6:49 PM, Michael Niedermayer wrote:
> > Fixes: left shift of negative value -456
> > Fixes: 15561/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPC8_fuzzer-5758130404720640
> > 
> > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >  libavcodec/mpc8.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c
> > index 3be2f79a5a..75943064da 100644
> > --- a/libavcodec/mpc8.c
> > +++ b/libavcodec/mpc8.c
> > @@ -364,7 +364,7 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
> >                  for(j = 0; j < SAMPLES_PER_BAND; j += SAMPLES_PER_BAND / 2){
> >                      cnt = get_vlc2(gb, q1_vlc.table, MPC8_Q1_BITS, 2);
> >                      t = mpc8_get_mask(gb, 18, cnt);
> > -                    for(k = 0; k < SAMPLES_PER_BAND / 2; k++, t <<= 1)
> > +                    for(k = 0; k < SAMPLES_PER_BAND / 2; k++, t += (unsigned)t)
> 
> How about something like this instead (Untested)
> 
> for(k = 0; k < SAMPLES_PER_BAND / 2; k++)
>     c->Q[ch][off + j + k] = t & (1 << (SAMPLES_PER_BAND / 2 - k - 1))
>                             ? (get_bits1(gb) << 1) - 1 : 0;

tested, works, will apply with this

Thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Whats the most studid thing your enemy could do ? Blow himself up
Whats the most studid thing you could do ? Give up your rights and
freedom because your enemy blew himself up.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190713/0ecae0cf/attachment.sig>


More information about the ffmpeg-devel mailing list