Commit 526886e6 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/diracdec: Use 64bit in calculation of codeblock coordinates

Fixes integer overflow
Fixes out of array read
Fixes: asan_heap-oob_107866c_42_041.drc
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent d4e8cc35
...@@ -612,10 +612,10 @@ static av_always_inline void decode_subband_internal(DiracContext *s, SubBand *b ...@@ -612,10 +612,10 @@ static av_always_inline void decode_subband_internal(DiracContext *s, SubBand *b
top = 0; top = 0;
for (cb_y = 0; cb_y < cb_height; cb_y++) { for (cb_y = 0; cb_y < cb_height; cb_y++) {
bottom = (b->height * (cb_y+1)) / cb_height; bottom = (b->height * (cb_y+1LL)) / cb_height;
left = 0; left = 0;
for (cb_x = 0; cb_x < cb_width; cb_x++) { for (cb_x = 0; cb_x < cb_width; cb_x++) {
right = (b->width * (cb_x+1)) / cb_width; right = (b->width * (cb_x+1LL)) / cb_width;
codeblock(s, b, &gb, &c, left, right, top, bottom, blockcnt_one, is_arith); codeblock(s, b, &gb, &c, left, right, top, bottom, blockcnt_one, is_arith);
left = right; left = right;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment