summaryrefslogtreecommitdiff
path: root/libavformat/omadec.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-09-11 14:54:05 +0300
committerMartin Storsjö <martin@martin.st>2013-09-16 11:04:52 +0300
commit342c43d154e586bc022c86b168fe8d36f69da9d3 (patch)
tree38aefee9f9ccf037ce87726f096a4acaa98257f6 /libavformat/omadec.c
parenta06a5b78e2c3bd2e12aff0627a3b65c6fee555a5 (diff)
omadec: Properly check lengths before incrementing the position
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/omadec.c')
-rw-r--r--libavformat/omadec.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/omadec.c b/libavformat/omadec.c
index e49178290e..274112e5af 100644
--- a/libavformat/omadec.c
+++ b/libavformat/omadec.c
@@ -172,7 +172,11 @@ static int nprobe(AVFormatContext *s, uint8_t *enc_header, unsigned size,
taglen = AV_RB32(&enc_header[pos + 32]);
datalen = AV_RB32(&enc_header[pos + 36]) >> 4;
- pos += 44 + taglen;
+ pos += 44;
+ if (size - pos < taglen)
+ return -1;
+
+ pos += taglen;
if (datalen << 4 > size - pos)
return -1;