diff mbox

[FFmpeg-devel,4/5] avcodec/tiff: Set FF_CODEC_CAP_INIT_CLEANUP

Message ID 20191002213740.17936-4-michael@niedermayer.cc
State Accepted
Commit 379e5d29d50ef957a65cfd536bc8c0713755fb77
Headers show

Commit Message

Michael Niedermayer Oct. 2, 2019, 9:37 p.m. UTC
Fixes: memleaks
Fixes: 17813/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5145600206569472

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

Comments

Paul B Mahol Oct. 3, 2019, 6:54 a.m. UTC | #1
probably lgtm

On 10/2/19, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Fixes: memleaks
> Fixes:
> 17813/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5145600206569472
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/tiff.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
> index 9f24796a88..f537e99b5a 100644
> --- a/libavcodec/tiff.c
> +++ b/libavcodec/tiff.c
> @@ -2090,8 +2090,6 @@ static av_cold int tiff_init(AVCodecContext *avctx)
>      s->avctx_mjpeg->idct_algo = avctx->idct_algo;
>      ret = ff_codec_open2_recursive(s->avctx_mjpeg, codec, NULL);
>      if (ret < 0) {
> -        av_frame_free(&s->jpgframe);
> -        avcodec_free_context(&s->avctx_mjpeg);
>          return ret;
>      }
>
> @@ -2142,5 +2140,6 @@ AVCodec ff_tiff_decoder = {
>      .decode         = decode_frame,
>      .init_thread_copy = ONLY_IF_THREADS_ENABLED(tiff_init),
>      .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
> +    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
>      .priv_class     = &tiff_decoder_class,
>  };
> --
> 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 Oct. 3, 2019, 5:39 p.m. UTC | #2
On Thu, Oct 03, 2019 at 08:54:19AM +0200, Paul B Mahol wrote:
> probably lgtm

will apply

thx

[...]
diff mbox

Patch

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 9f24796a88..f537e99b5a 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -2090,8 +2090,6 @@  static av_cold int tiff_init(AVCodecContext *avctx)
     s->avctx_mjpeg->idct_algo = avctx->idct_algo;
     ret = ff_codec_open2_recursive(s->avctx_mjpeg, codec, NULL);
     if (ret < 0) {
-        av_frame_free(&s->jpgframe);
-        avcodec_free_context(&s->avctx_mjpeg);
         return ret;
     }
 
@@ -2142,5 +2140,6 @@  AVCodec ff_tiff_decoder = {
     .decode         = decode_frame,
     .init_thread_copy = ONLY_IF_THREADS_ENABLED(tiff_init),
     .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .priv_class     = &tiff_decoder_class,
 };