kumquat-buildroot/package/ffmpeg/0010-fixed-memleak-in-mpegts-demuxer-on-some-malformed-mp.patch
Thomas Petazzoni 2c2fd3c257 package/ffmpeg: Add Kodi patchset
In the past xbmc delivered its own ffmpeg source code with specific patches to
address bugs found during the use of xbmc. For Helix the ffmpeg source code was
removed, Helix uses a vanilla ffmpeg source tarball and applies this patchset
on top of it.

Downloaded from
https://github.com/xbmc/FFmpeg/compare/FFmpeg:release/2.5...release/2.5-xbmc.patch

[Thomas: use individual patches instead.]

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-12-27 19:58:29 +01:00

45 lines
1.3 KiB
Diff

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
@@ -832,6 +832,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;
@@ -2649,6 +2653,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