diff mbox

[FFmpeg-devel,2/4] avcodec/nuv: Use ff_set_dimensions()

Message ID 20191123172119.20709-2-michael@niedermayer.cc
State Accepted
Commit 1ca978d6366f3c7d7df6b3d50566e892f8da605a
Headers show

Commit Message

Michael Niedermayer Nov. 23, 2019, 5:21 p.m. UTC
Fixes: OOM
Fixes: 18956/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NUV_fuzzer-5766505644163072

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

Comments

Paul B Mahol Nov. 24, 2019, 10:53 a.m. UTC | #1
lgtm

On 11/23/19, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Fixes: OOM
> Fixes:
> 18956/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NUV_fuzzer-5766505644163072
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/nuv.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
> index bb80e3e884..db3246b8dd 100644
> --- a/libavcodec/nuv.c
> +++ b/libavcodec/nuv.c
> @@ -131,10 +131,10 @@ static int codec_reinit(AVCodecContext *avctx, int
> width, int height,
>                       + RTJPEG_HEADER_SIZE;
>          if (buf_size > INT_MAX/8)
>              return -1;
> -        if ((ret = av_image_check_size(height, width, 0, avctx)) < 0)
> +        if ((ret = ff_set_dimensions(avctx, width, height)) < 0)
>              return ret;
> -        avctx->width  = c->width  = width;
> -        avctx->height = c->height = height;
> +        c->width  = width;
> +        c->height = height;
>          av_fast_malloc(&c->decomp_buf, &c->decomp_size,
>                         buf_size);
>          if (!c->decomp_buf) {
> --
> 2.23.0
>
> _______________________________________________
> 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 Nov. 24, 2019, 10:04 p.m. UTC | #2
On Sun, Nov 24, 2019 at 11:53:16AM +0100, Paul B Mahol wrote:
> lgtm

will apply
thx

[...]
diff mbox

Patch

diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
index bb80e3e884..db3246b8dd 100644
--- a/libavcodec/nuv.c
+++ b/libavcodec/nuv.c
@@ -131,10 +131,10 @@  static int codec_reinit(AVCodecContext *avctx, int width, int height,
                      + RTJPEG_HEADER_SIZE;
         if (buf_size > INT_MAX/8)
             return -1;
-        if ((ret = av_image_check_size(height, width, 0, avctx)) < 0)
+        if ((ret = ff_set_dimensions(avctx, width, height)) < 0)
             return ret;
-        avctx->width  = c->width  = width;
-        avctx->height = c->height = height;
+        c->width  = width;
+        c->height = height;
         av_fast_malloc(&c->decomp_buf, &c->decomp_size,
                        buf_size);
         if (!c->decomp_buf) {