Commit 52b2e95c authored by Jindrich Makovicka's avatar Jindrich Makovicka Committed by Michael Niedermayer

dvdsubdec.c: prevent input buffer overflow

In some places, dvbsubdec passes improper input buffer size to
bitstream reading functions, not accounting for reading pointer
updates.

Fixed by using buffer_end - buffer pointer instead of fixed buffer length.
Signed-off-by: 's avatarJindrich Makovicka <makovick@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 6a495e98
......@@ -792,7 +792,7 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis
map_table = NULL;
x_pos += dvbsub_read_2bit_string(pbuf + (y_pos * region->width) + x_pos,
region->width - x_pos, &buf, buf_size,
region->width - x_pos, &buf, buf_end - buf,
non_mod, map_table);
break;
case 0x11:
......@@ -807,7 +807,7 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis
map_table = NULL;
x_pos += dvbsub_read_4bit_string(pbuf + (y_pos * region->width) + x_pos,
region->width - x_pos, &buf, buf_size,
region->width - x_pos, &buf, buf_end - buf,
non_mod, map_table);
break;
case 0x12:
......@@ -817,7 +817,7 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis
}
x_pos += dvbsub_read_8bit_string(pbuf + (y_pos * region->width) + x_pos,
region->width - x_pos, &buf, buf_size,
region->width - x_pos, &buf, buf_end - buf,
non_mod, NULL);
break;
......
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