diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-04-28 22:37:19 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-05-21 20:43:37 +0200 |
commit | 8016800a64837332104fba122c2f73f926cb9f2a (patch) | |
tree | 73f8b590511d61302cf1759b8cc50e6be76a3b8d | |
parent | 4158d55b9a9c9aad5641f13b73db2f618e83f8f5 (diff) | |
download | ffmpeg-8016800a64837332104fba122c2f73f926cb9f2a.tar.gz |
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>
(cherry picked from commit 7c24ca1bda2d4df1dc9b2b982941be532d60da21)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/nutdec.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 0a81261376..02a4b1e11e 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; } |