diff mbox series

[FFmpeg-devel,1/2] avcodec/mobiclip: check for pmode=2 ax/ay=0

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

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 access
Fixes: 25452/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5081657055641600

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 | 3 +++
 1 file changed, 3 insertions(+)

Comments

Paul B Mahol Sept. 12, 2020, 2:49 p.m. UTC | #1
On Sat, Sep 12, 2020 at 04:35:54PM +0200, Michael Niedermayer wrote:
> Fixes: out of array access
> Fixes: 25452/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5081657055641600
> 
> 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 | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
> index 13f0edc89d..3ede370bef 100644
> --- a/libavcodec/mobiclip.c
> +++ b/libavcodec/mobiclip.c
> @@ -914,6 +914,9 @@ static int predict_intra(AVCodecContext *avctx, AVFrame *frame, int ax, int ay,
>              int shift = adjust(size, size) == 8 ? 3 : 2;
>              uint8_t *block;
>  
> +            if (ax == 0 && ay == 0)
> +                return -1;
> +

Please clip it instead, FFMAX(ax - 1, 0) above.

I forgot to do it.

>              for (int x = 0; x < size; x++) {
>                  int val = top[x];
>                  arr1[x] = adjust(((bottommost - val) * (1 << shift)) + r6 * (x + 1), size);
> -- 
> 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".
diff mbox series

Patch

diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
index 13f0edc89d..3ede370bef 100644
--- a/libavcodec/mobiclip.c
+++ b/libavcodec/mobiclip.c
@@ -914,6 +914,9 @@  static int predict_intra(AVCodecContext *avctx, AVFrame *frame, int ax, int ay,
             int shift = adjust(size, size) == 8 ? 3 : 2;
             uint8_t *block;
 
+            if (ax == 0 && ay == 0)
+                return -1;
+
             for (int x = 0; x < size; x++) {
                 int val = top[x];
                 arr1[x] = adjust(((bottommost - val) * (1 << shift)) + r6 * (x + 1), size);