mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-01 21:48:15 +08:00
rpza: error out on buffer overreads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org
This commit is contained in:
@ -183,6 +183,8 @@ static void rpza_decode_stream(RpzaContext *s)
|
|||||||
color4[1] |= ((11 * ta + 21 * tb) >> 5);
|
color4[1] |= ((11 * ta + 21 * tb) >> 5);
|
||||||
color4[2] |= ((21 * ta + 11 * tb) >> 5);
|
color4[2] |= ((21 * ta + 11 * tb) >> 5);
|
||||||
|
|
||||||
|
if (s->size - stream_ptr < n_blocks * 4)
|
||||||
|
return;
|
||||||
while (n_blocks--) {
|
while (n_blocks--) {
|
||||||
block_ptr = row_ptr + pixel_ptr;
|
block_ptr = row_ptr + pixel_ptr;
|
||||||
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
|
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
|
||||||
@ -200,6 +202,8 @@ static void rpza_decode_stream(RpzaContext *s)
|
|||||||
|
|
||||||
/* Fill block with 16 colors */
|
/* Fill block with 16 colors */
|
||||||
case 0x00:
|
case 0x00:
|
||||||
|
if (s->size - stream_ptr < 16)
|
||||||
|
return;
|
||||||
block_ptr = row_ptr + pixel_ptr;
|
block_ptr = row_ptr + pixel_ptr;
|
||||||
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
|
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
|
||||||
for (pixel_x = 0; pixel_x < 4; pixel_x++){
|
for (pixel_x = 0; pixel_x < 4; pixel_x++){
|
||||||
|
Reference in New Issue
Block a user