diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2010-12-11 21:41:47 +0000 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2010-12-11 21:41:47 +0000 |
commit | 4172951ba7e5e8450d2b081fa9516454fdfa1329 (patch) | |
tree | f56a36466b2646038bfb09771daf515c17d48141 /libavformat | |
parent | 3c3ef81b9b17c992bbff9b521d871c8c250ae53c (diff) | |
download | ffmpeg-4172951ba7e5e8450d2b081fa9516454fdfa1329.tar.gz |
Return an error when get_buffer reads none or only partial data instead
of returning packets with uninitialized data.
Returning partial packets as for other demuxers is problematice due to
packet scrambling and thus is not done.
Originally committed as revision 25931 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/asfdec.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 6918e20123..843b109511 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -848,6 +848,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket * ASFContext *asf = s->priv_data; ASFStream *asf_st = 0; for (;;) { + int ret; if(url_feof(pb)) return AVERROR_EOF; if (asf->packet_size_left < FRAME_HEADER_SIZE @@ -950,8 +951,10 @@ static int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket * continue; } - get_buffer(pb, asf_st->pkt.data + asf->packet_frag_offset, - asf->packet_frag_size); + ret = get_buffer(pb, asf_st->pkt.data + asf->packet_frag_offset, + asf->packet_frag_size); + if (ret != asf->packet_frag_size) + return ret >= 0 ? AVERROR_EOF : ret; if (s->key && s->keylen == 20) ff_asfcrypt_dec(s->key, asf_st->pkt.data + asf->packet_frag_offset, asf->packet_frag_size); |