summaryrefslogtreecommitdiff
path: root/libavformat/nsvdec.c
diff options
context:
space:
mode:
authorAlex Converse <alex.converse@gmail.com>2012-01-26 17:23:09 -0800
committerAlex Converse <alex.converse@gmail.com>2012-01-30 10:15:41 -0800
commitc898431ca5ef2a997fe9388b650f658fb60783e5 (patch)
tree5cd02b57abc83e85531c4af880da0fe2a41f01bd /libavformat/nsvdec.c
parent8fd8a48263ff1437f9d02d7e78dc63efb9b5ed3a (diff)
nsvdec: Propagate errors
Related to CVE-2011-3940. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Diffstat (limited to 'libavformat/nsvdec.c')
-rw-r--r--libavformat/nsvdec.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index 7e32e439ea..2ad8cb3a8b 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -532,11 +532,16 @@ static int nsv_read_header(AVFormatContext *s)
for (i = 0; i < NSV_MAX_RESYNC_TRIES; i++) {
if (nsv_resync(s) < 0)
return -1;
- if (nsv->state == NSV_FOUND_NSVF)
+ if (nsv->state == NSV_FOUND_NSVF) {
err = nsv_parse_NSVf_header(s);
+ if (err < 0)
+ return err;
+ }
/* we need the first NSVs also... */
if (nsv->state == NSV_FOUND_NSVS) {
err = nsv_parse_NSVs_header(s);
+ if (err < 0)
+ return err;
break; /* we just want the first one */
}
}