mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-03 05:22:10 +00:00
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>
This commit is contained in:
parent
361702660d
commit
7c24ca1bda
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user