summaryrefslogtreecommitdiff
path: root/libavformat/omadec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-10 17:22:27 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-10 17:22:27 +0200
commit91e72e35141f590c38985ad0ae3453a4e9e86b8a (patch)
tree92c98ef07b208286149c7099c6df1849fc7e6a5c /libavformat/omadec.c
parenteee89f691edbedbfcb206fbe21b9675756dbe5d1 (diff)
omadec: Check geob datasize more completely
Fixes out of heap array read. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/omadec.c')
-rw-r--r--libavformat/omadec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/omadec.c b/libavformat/omadec.c
index c88d4f4d48..1cd8fdf9d5 100644
--- a/libavformat/omadec.c
+++ b/libavformat/omadec.c
@@ -219,7 +219,9 @@ static int decrypt_init(AVFormatContext *s, ID3v2ExtraMeta *em, uint8_t *header)
av_log(s, AV_LOG_ERROR, "Invalid encryption header\n");
return -1;
}
- if (oc->k_size + oc->e_size + oc->i_size > geob->datasize) {
+ if ( OMA_ENC_HEADER_SIZE + oc->k_size + oc->e_size + oc->i_size + 8 > geob->datasize
+ || OMA_ENC_HEADER_SIZE + 48 > geob->datasize
+ ) {
av_log(s, AV_LOG_ERROR, "Too little GEOB data\n");
return AVERROR_INVALIDDATA;
}