aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@google.com>2011-04-27 15:42:16 -0700
committerRonald S. Bultje <rsbultje@gmail.com>2011-05-03 22:14:04 -0400
commitf8b1245922cf4c7692750e9198cf57598f9647d5 (patch)
treef74772398b8e890f99a08105d39bf52cdef2264d /libavformat
parent8ce67bcabe7f50622430c11c3384675f095c78b5 (diff)
downloadffmpeg-f8b1245922cf4c7692750e9198cf57598f9647d5.tar.gz
asfdec: fix parsing of packets that overrun into padding.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/asfdec.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 8e10d68b62..637ceed34a 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -853,8 +853,14 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
if (asf->packet_flags & 0x01) {
DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); // 0 is illegal
if(asf->packet_frag_size > asf->packet_size_left - rsize){
- av_log(s, AV_LOG_ERROR, "packet_frag_size is invalid\n");
- return -1;
+ if (asf->packet_frag_size > asf->packet_size_left - rsize + asf->packet_padsize) {
+ av_log(s, AV_LOG_ERROR, "packet_frag_size is invalid (%d-%d)\n", asf->packet_size_left, rsize);
+ return -1;
+ } else {
+ int diff = asf->packet_frag_size - (asf->packet_size_left - rsize);
+ asf->packet_size_left += diff;
+ asf->packet_padsize -= diff;
+ }
}
//printf("Fragsize %d\n", asf->packet_frag_size);
} else {