[FFmpeg-cvslog] avcodec/flashsv: Clear pointers
Michael Niedermayer
git at videolan.org
Thu Jul 7 23:00:01 EEST 2022
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu Jun 9 01:59:34 2022 +0200| [b418ad75c2238d36b1d28050e7f37911b9ae64d4] | committer: Michael Niedermayer
avcodec/flashsv: Clear pointers
Fixes: Use after free
Fixes: 47399/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLASHSV2_fuzzer-5718646686613504
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b418ad75c2238d36b1d28050e7f37911b9ae64d4
---
libavcodec/flashsv.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c
index d8943d9cf8..4357b25d04 100644
--- a/libavcodec/flashsv.c
+++ b/libavcodec/flashsv.c
@@ -350,6 +350,9 @@ static int flashsv_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
if (err < 0)
return err;
s->keyframedata = avpkt->data;
+ if (s->blocks)
+ memset(s->blocks, 0, (v_blocks + !!v_part) * (h_blocks + !!h_part) *
+ sizeof(s->blocks[0]));
}
if(s->ver == 2 && !s->blocks)
s->blocks = av_mallocz((v_blocks + !!v_part) * (h_blocks + !!h_part) *
@@ -558,6 +561,7 @@ static av_cold int flashsv2_decode_end(AVCodecContext *avctx)
FlashSVContext *s = avctx->priv_data;
av_buffer_unref(&s->keyframedata_buf);
+ s->keyframedata = NULL;
av_freep(&s->blocks);
av_freep(&s->keyframe);
flashsv_decode_end(avctx);
More information about the ffmpeg-cvslog
mailing list