[FFmpeg-cvslog] avcodec/bink: Reorder operations in init to avoid memleak on error
Michael Niedermayer
git at videolan.org
Thu Jun 27 20:49:08 EEST 2019
ffmpeg | branch: release/4.1 | Michael Niedermayer <michael at niedermayer.cc> | Sat Jun 15 21:52:24 2019 +0200| [6e26b1b0b18df60f77f6c0878438783a8b851f6f] | committer: Michael Niedermayer
avcodec/bink: Reorder operations in init to avoid memleak on error
Fixes: Direct leak of 536 byte(s) in 1 object(s)
Fixes: 15266/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINK_fuzzer-5629530426834944
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross at xvid.org>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 2603f25d326476a83f5d093b522590b05b6e703b)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6e26b1b0b18df60f77f6c0878438783a8b851f6f
---
libavcodec/bink.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index 9c17dedcba..a0784f9482 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -1335,13 +1335,13 @@ static av_cold int decode_init(AVCodecContext *avctx)
}
c->avctx = avctx;
+ if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0)
+ return ret;
+
c->last = av_frame_alloc();
if (!c->last)
return AVERROR(ENOMEM);
- if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0)
- return ret;
-
avctx->pix_fmt = c->has_alpha ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
avctx->color_range = c->version == 'k' ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
More information about the ffmpeg-cvslog
mailing list