[FFmpeg-devel,3/3] avcodec/utils: fix leak of subtitle_header on error path

Submitted by Michael Niedermayer on July 4, 2019, 11:28 p.m.

Details

Message ID 20190704232835.32235-3-michael@niedermayer.cc
State Accepted
Commit 923d5c489fd4ffd0b9dbfdc6c14f594bd134ab47
Headers show

Commit Message

Michael Niedermayer July 4, 2019, 11:28 p.m.
Fixes: memleak
Fixes: 15528/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_STL_fuzzer-5735993371525120

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

Comments

Michael Niedermayer July 24, 2019, 9:38 p.m.
On Fri, Jul 05, 2019 at 01:28:35AM +0200, Michael Niedermayer wrote:
> Fixes: memleak
> Fixes: 15528/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_STL_fuzzer-5735993371525120
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/utils.c | 1 +
>  1 file changed, 1 insertion(+)

will apply with several additional cases mentioned in the commit message
as i found more cases that hit this same leak


[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 1b1feca38c..56ff70b744 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1038,6 +1038,7 @@  FF_ENABLE_DEPRECATION_WARNINGS
 
     av_dict_free(&tmp);
     av_freep(&avctx->priv_data);
+    av_freep(&avctx->subtitle_header);
     if (avctx->internal) {
         av_frame_free(&avctx->internal->to_free);
         av_frame_free(&avctx->internal->compat_decode_frame);