[FFmpeg-cvslog] avformat/jacosubdec: Cleanup when avpriv_bprint_to_extradata() fails

Michael Niedermayer git at videolan.org
Tue Nov 25 15:28:38 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Nov 25 15:20:02 2014 +0100| [8cd80b5fcbfaefdb92faa8f3ed0b7f5651f38481] | committer: Michael Niedermayer

avformat/jacosubdec: Cleanup when avpriv_bprint_to_extradata() fails

Fixes memleaks
Fixes: asan_heap-oob_4d2250_814_cov_2745172097_JACOsub_capability_tester.jss
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8cd80b5fcbfaefdb92faa8f3ed0b7f5651f38481
---

 libavformat/jacosubdec.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index 9a28870..1ca0055 100644
--- a/libavformat/jacosubdec.c
+++ b/libavformat/jacosubdec.c
@@ -232,7 +232,7 @@ static int jacosub_read_header(AVFormatContext *s)
     /* general/essential directives in the extradata */
     ret = avpriv_bprint_to_extradata(st->codec, &header);
     if (ret < 0)
-        return ret;
+        goto fail;
 
     /* SHIFT and TIMERES affect the whole script so packet timing can only be
      * done in a second pass */
@@ -243,6 +243,9 @@ static int jacosub_read_header(AVFormatContext *s)
     ff_subtitles_queue_finalize(&jacosub->q);
 
     return 0;
+fail:
+    jacosub_read_close(s);
+    return ret;
 }
 
 static int jacosub_read_packet(AVFormatContext *s, AVPacket *pkt)



More information about the ffmpeg-cvslog mailing list