]> git.webhop.me Git - bs-cst-neutrino-hd.git/commitdiff
fix memleak in ffmpeg mpegts demuxer on some malformed mpegts files with too large...
authorMarkham <markham001@gmx.de>
Sun, 7 Feb 2016 07:11:13 +0000 (08:11 +0100)
committerMarkham <markham001@gmx.de>
Sun, 7 Feb 2016 07:11:13 +0000 (08:11 +0100)
archive-patches/ffmpeg-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mpegts-files.patch [new file with mode: 0644]
make/libraries.mk

diff --git a/archive-patches/ffmpeg-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mpegts-files.patch b/archive-patches/ffmpeg-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mpegts-files.patch
new file mode 100644 (file)
index 0000000..d280124
--- /dev/null
@@ -0,0 +1,44 @@
+From cb7c19124165508ae5f38a385a14f9c13b096a27 Mon Sep 17 00:00:00 2001
+From: Joakim Plate <elupus@ecce.se>
+Date: Fri, 26 Nov 2010 20:56:48 +0000
+Subject: [PATCH 10/13] fixed: memleak in mpegts demuxer on some malformed (??)
+ mpegts files with too large pes packets
+
+at-visions sample file brokenStream.mpg
+
+Patch part of the XBMC patch set for ffmpeg, downloaded from
+https://github.com/xbmc/FFmpeg/.
+
+Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ libavformat/mpegts.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
+index d5a8a45..e070f1f 100644
+--- a/libavformat/mpegts.c
++++ b/libavformat/mpegts.c
+@@ -850,6 +850,10 @@ static void reset_pes_packet_state(PESContext *pes)
+ static void new_pes_packet(PESContext *pes, AVPacket *pkt)
+ {
++    if(pkt->data) {
++      av_log(pes->stream, AV_LOG_ERROR, "ignoring previously allocated packet on stream %d\n", pkt->stream_index);
++      av_free_packet(pkt);
++    }
+     av_init_packet(pkt);
+     pkt->buf  = pes->buffer;
+@@ -2644,6 +2649,8 @@ static int mpegts_read_packet(AVFormatContext *s, AVPacket *pkt)
+     pkt->size = -1;
+     ts->pkt = pkt;
++    ts->pkt->data = NULL;
++
+     ret = handle_packets(ts, 0);
+     if (ret < 0) {
+         av_free_packet(ts->pkt);
+-- 
+2.1.0
+
index d2a3d0a8f55203d372491dc79493fbf089593161..11bb7a681bb78a2c4cee7133c1336d99f37a3a7d 100755 (executable)
@@ -446,6 +446,7 @@ endif
 $(D)/ffmpeg: $(D)/librtmp $(D)/libxml2 | $(TARGETPREFIX)
        tar -C $(SOURCE_DIR)/git/LIBRARIES -cp ffmpeg/$(CST_FFMPEG_VERSION) --exclude=.git | tar -C $(BUILD_TMP) -x
        pushd $(BUILD_TMP)/ffmpeg/$(CST_FFMPEG_VERSION) && \
+               $(PATCH)/ffmpeg-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mpegts-files.patch; \
                $(BUILDENV) \
                ./configure \
                        $(FFMPEG_CONFIGURE) \