mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avformat/dxa: Adjust order of operations around block align
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_DXA_fuzzer-5730576523198464 Fixes: signed integer overflow: 2147483566 + 82 cannot be represented in type 'int' Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
d973fcbcc2
commit
50d8e4f273
@ -123,7 +123,7 @@ static int dxa_read_header(AVFormatContext *s)
|
|||||||
if(ast->codecpar->block_align) {
|
if(ast->codecpar->block_align) {
|
||||||
if (c->bpc > INT_MAX - ast->codecpar->block_align + 1)
|
if (c->bpc > INT_MAX - ast->codecpar->block_align + 1)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
c->bpc = ((c->bpc + ast->codecpar->block_align - 1) / ast->codecpar->block_align) * ast->codecpar->block_align;
|
c->bpc = ((c->bpc - 1 + ast->codecpar->block_align) / ast->codecpar->block_align) * ast->codecpar->block_align;
|
||||||
}
|
}
|
||||||
c->bytes_left = fsize;
|
c->bytes_left = fsize;
|
||||||
c->wavpos = avio_tell(pb);
|
c->wavpos = avio_tell(pb);
|
||||||
|
Loading…
Reference in New Issue
Block a user