aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-14 02:38:13 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-14 02:41:36 +0200
commit04064e1c200832c344b97307e24c30653d9835ce (patch)
treeed631a78c707d67457955f108bd917660143b7f0 /libavformat
parent0db047cd0fcfcf507fd8a5b1cea883de15be0a23 (diff)
downloadffmpeg-04064e1c200832c344b97307e24c30653d9835ce.tar.gz
mpegts: fix handling of files smaller than 8kb
Fixes Ticket1094 Analyzed-by: mjs973 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mpegts.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 4489a58e50..e77b9a79dd 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1929,16 +1929,14 @@ static int mpegts_read_header(AVFormatContext *s)
{
MpegTSContext *ts = s->priv_data;
AVIOContext *pb = s->pb;
- uint8_t buf[8*1024];
+ uint8_t buf[8*1024]={0};
int len;
int64_t pos;
/* read the first 8192 bytes to get packet size */
pos = avio_tell(pb);
len = avio_read(pb, buf, sizeof(buf));
- if (len != sizeof(buf))
- goto fail;
- ts->raw_packet_size = get_packet_size(buf, sizeof(buf));
+ ts->raw_packet_size = get_packet_size(buf, len);
if (ts->raw_packet_size <= 0) {
av_log(s, AV_LOG_WARNING, "Could not detect TS packet size, defaulting to non-FEC/DVHS\n");
ts->raw_packet_size = TS_PACKET_SIZE;