[FFmpeg-cvslog] mpegts: Make sure we don't return uninitialized packets
Martin Storsjö
git at videolan.org
Fri Apr 27 23:02:50 CEST 2012
ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Sat Apr 21 20:44:24 2012 +0300| [df8aa4598c7cc1c2f863f6fc6b2d4b3e6dc7345e] | committer: Martin Storsjö
mpegts: Make sure we don't return uninitialized packets
This fixes crashes, where the demuxer could return 0 even
if the returned AVPacket isn't initialized at all. This
could happen if running into EOF or running out of probesize
with non-seekable sources.
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=df8aa4598c7cc1c2f863f6fc6b2d4b3e6dc7345e
---
libavformat/mpegts.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index c853e72..2222f25 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2020,6 +2020,7 @@ static int mpegts_read_packet(AVFormatContext *s,
MpegTSContext *ts = s->priv_data;
int ret, i;
+ pkt->size = -1;
ts->pkt = pkt;
ret = handle_packets(ts, 0);
if (ret < 0) {
@@ -2037,6 +2038,8 @@ static int mpegts_read_packet(AVFormatContext *s,
}
}
+ if (!ret && pkt->size < 0)
+ ret = AVERROR(EINTR);
return ret;
}
More information about the ffmpeg-cvslog
mailing list