aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/asfdec.c
diff options
context:
space:
mode:
authorUoti Urpala <uoti.urpala.pp1.inet.fi>2011-04-24 07:21:30 +0300
committerRonald S. Bultje <rsbultje@gmail.com>2011-05-03 22:36:08 -0400
commit0bd433a916cd8d98fce47742fbf6d0f90ec941c4 (patch)
tree162227da8ce9a68fa4c3c2d824e48d734c51ace3 /libavformat/asfdec.c
parent0699dbb8478886826dedb1c33a0b74142a1cd863 (diff)
downloadffmpeg-0bd433a916cd8d98fce47742fbf6d0f90ec941c4.tar.gz
asfdec: fix assert failure on invalid files
Add an extra size validity check in asf_read_frame_header(). Without this asf->packet_size_left may become negative, which triggers an assertion failure later. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavformat/asfdec.c')
-rw-r--r--libavformat/asfdec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 637ceed34a..77c84490a0 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -864,6 +864,10 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
}
//printf("Fragsize %d\n", asf->packet_frag_size);
} else {
+ if (rsize > asf->packet_size_left) {
+ av_log(s, AV_LOG_ERROR, "packet_replic_size is invalid\n");
+ return -1;
+ }
asf->packet_frag_size = asf->packet_size_left - rsize;
//printf("Using rest %d %d %d\n", asf->packet_frag_size, asf->packet_size_left, rsize);
}