diff mbox series

[FFmpeg-devel,2/2] avcodec/mobiclip: set the bitstream size to the input

Message ID 20200912143555.14421-2-michael@niedermayer.cc
State Accepted
Commit b6b640c5448f4a53e49caf93ccd665346d7598ef
Headers show
Series [FFmpeg-devel,1/2] avcodec/mobiclip: check for pmode=2 ax/ay=0 | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Michael Niedermayer Sept. 12, 2020, 2:35 p.m. UTC
Fixes: out of array read
Fixes: 25453/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5163575973511168

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/mobiclip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul B Mahol Sept. 12, 2020, 2:51 p.m. UTC | #1
On Sat, Sep 12, 2020 at 04:35:55PM +0200, Michael Niedermayer wrote:
> Fixes: out of array read
> Fixes: 25453/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5163575973511168
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/mobiclip.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
> index 3ede370bef..08a35218cc 100644
> --- a/libavcodec/mobiclip.c
> +++ b/libavcodec/mobiclip.c
> @@ -1306,7 +1306,7 @@ static int mobiclip_decode(AVCodecContext *avctx, void *data,
>                          (uint16_t *)pkt->data,
>                          (pkt->size + 1) >> 1);
>  
> -    ret = init_get_bits8(gb, s->bitstream, s->bitstream_size);
> +    ret = init_get_bits8(gb, s->bitstream, FFALIGN(pkt->size, 2));
>      if (ret < 0)
>          return ret;

ok.

>  
> -- 
> 2.17.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Michael Niedermayer Oct. 15, 2020, 8:40 p.m. UTC | #2
On Sat, Sep 12, 2020 at 04:51:04PM +0200, Paul B Mahol wrote:
> On Sat, Sep 12, 2020 at 04:35:55PM +0200, Michael Niedermayer wrote:
> > Fixes: out of array read
> > Fixes: 25453/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5163575973511168
> > 
> > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/mobiclip.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
> > index 3ede370bef..08a35218cc 100644
> > --- a/libavcodec/mobiclip.c
> > +++ b/libavcodec/mobiclip.c
> > @@ -1306,7 +1306,7 @@ static int mobiclip_decode(AVCodecContext *avctx, void *data,
> >                          (uint16_t *)pkt->data,
> >                          (pkt->size + 1) >> 1);
> >  
> > -    ret = init_get_bits8(gb, s->bitstream, s->bitstream_size);
> > +    ret = init_get_bits8(gb, s->bitstream, FFALIGN(pkt->size, 2));
> >      if (ret < 0)
> >          return ret;
> 
> ok.

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
index 3ede370bef..08a35218cc 100644
--- a/libavcodec/mobiclip.c
+++ b/libavcodec/mobiclip.c
@@ -1306,7 +1306,7 @@  static int mobiclip_decode(AVCodecContext *avctx, void *data,
                         (uint16_t *)pkt->data,
                         (pkt->size + 1) >> 1);
 
-    ret = init_get_bits8(gb, s->bitstream, s->bitstream_size);
+    ret = init_get_bits8(gb, s->bitstream, FFALIGN(pkt->size, 2));
     if (ret < 0)
         return ret;