Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-04-28 23:37:19 +0300
committerMichael Niedermayer <michaelni@gmx.at>2015-04-28 23:56:14 +0300
commit7c24ca1bda2d4df1dc9b2b982941be532d60da21 (patch)
tree63bfdf80a0ae8e8cb598c6f1d1eacbca40474552 /libavformat/nutdec.c
parent361702660d2c37a63b7d6381d39e1e1de8405260 (diff)
nutdec: fix illegal count check in decode_main_header
The existing check has two problems: 1) i + count can overflow, so that the check '< 256' returns true. 2) In the (i == 'N') case occurs a j-- so that the loop runs once more. This can trigger the assertion 'nut->header_len[0] == 0' or cause segmentation faults or infinite hangs. Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/nutdec.c')
-rw-r--r--libavformat/nutdec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 2190d5ec48..a1c7495af7 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -294,7 +294,7 @@ static int decode_main_header(NUTContext *nut)
while (tmp_fields-- > 8)
ffio_read_varlen(bc);
- if (count == 0 || i + count > 256) {
+ if (count <= 0 || count > 256 - (i <= 'N') - i) {
av_log(s, AV_LOG_ERROR, "illegal count %d at %d\n", count, i);
return AVERROR_INVALIDDATA;
}