[FFmpeg-devel,3/3] avcodec/rasc: unref both frames on reinit

Submitted by Michael Niedermayer on Oct. 2, 2018, 1:04 a.m.

Details

Message ID 20181002010452.12356-3-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer Oct. 2, 2018, 1:04 a.m.
Fixes: integer overflow
Fixes: inconsistent frame dimensions
Fixes: 10454/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RASC_fuzzer-5656301162463232

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

Comments

Paul B Mahol Oct. 2, 2018, 7:27 a.m.
On 10/2/18, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Fixes: integer overflow
> Fixes: inconsistent frame dimensions
> Fixes:
> 10454/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RASC_fuzzer-5656301162463232
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---

LGTM

Patch hide | download patch | download mbox

diff --git a/libavcodec/rasc.c b/libavcodec/rasc.c
index eb021681c6..e8e0740ddd 100644
--- a/libavcodec/rasc.c
+++ b/libavcodec/rasc.c
@@ -95,10 +95,10 @@  static int init_frames(AVCodecContext *avctx)
     int ret;
 
     av_frame_unref(s->frame1);
+    av_frame_unref(s->frame2);
     if ((ret = ff_get_buffer(avctx, s->frame1, 0)) < 0)
         return ret;
 
-    av_frame_unref(s->frame2);
     if ((ret = ff_get_buffer(avctx, s->frame2, 0)) < 0)
         return ret;