mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-21 14:26:59 +00:00
avcodec/vmnc: Check that rectangles are within the picture
Prevents out of array accesses with CODEC_FLAG_EMU_EDGE Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit6ba02602aa
) Conflicts: libavcodec/vmnc.c Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit7c17207ab9
) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
c44ac4d81e
commit
e0f351a979
@ -275,6 +275,11 @@ static int decode_hextile(VmncContext *c, uint8_t* dst, const uint8_t* src, int
|
||||
}
|
||||
xy = *src++;
|
||||
wh = *src++;
|
||||
if ( (xy >> 4) + (wh >> 4) + 1 > w - i
|
||||
|| (xy & 0xF) + (wh & 0xF)+1 > h - j) {
|
||||
av_log(c->avctx, AV_LOG_ERROR, "Rectangle outside picture\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
paint_rect(dst2, xy >> 4, xy & 0xF, (wh>>4)+1, (wh & 0xF)+1, fg, bpp, stride);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user