mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-28 20:53:54 +02:00
avcodec/mjpegdec: Check index in ljpeg_decode_yuv_scan() before using it
Fixes: 04715144ba237443010554be0d05343f/asan_heap-oob_1eafc76_1737_c685b48041a563461839e4e7ab97abb8.jpg Fixes out of array access Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
fd0bf457b7
commit
d24888ef19
@ -1093,7 +1093,10 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
|
||||
dc = mjpeg_decode_dc(s, s->dc_index[i]);
|
||||
if(dc == 0xFFFFF)
|
||||
return -1;
|
||||
if(bits<=8){
|
||||
if ( h * mb_x + x >= s->width
|
||||
|| v * mb_y + y >= s->height) {
|
||||
// Nothing to do
|
||||
} else if (bits<=8) {
|
||||
ptr = s->picture_ptr->data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
|
||||
if(y==0 && toprow){
|
||||
if(x==0 && leftcol){
|
||||
@ -1161,7 +1164,10 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
|
||||
dc = mjpeg_decode_dc(s, s->dc_index[i]);
|
||||
if(dc == 0xFFFFF)
|
||||
return -1;
|
||||
if(bits<=8){
|
||||
if ( h * mb_x + x >= s->width
|
||||
|| v * mb_y + y >= s->height) {
|
||||
// Nothing to do
|
||||
} else if (bits<=8) {
|
||||
ptr = s->picture_ptr->data[c] +
|
||||
(linesize * (v * mb_y + y)) +
|
||||
(h * mb_x + x); //FIXME optimize this crap
|
||||
|
Loading…
Reference in New Issue
Block a user