1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

flicvideo: avoid an infinite loop in byte run compression

When byte_run is 0, pixel_countdown is not touched and the loop will run
forever.

CC:libav-stable@libav.org
This commit is contained in:
Anton Khirnov 2013-02-14 12:40:36 +01:00
parent 067432c1c9
commit ddfe1246d9

View File

@ -348,6 +348,11 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
pixel_countdown = s->avctx->width; pixel_countdown = s->avctx->width;
while (pixel_countdown > 0) { while (pixel_countdown > 0) {
byte_run = sign_extend(bytestream2_get_byte(&g2), 8); byte_run = sign_extend(bytestream2_get_byte(&g2), 8);
if (!byte_run) {
av_log(avctx, AV_LOG_ERROR, "Invalid byte run value.\n");
return AVERROR_INVALIDDATA;
}
if (byte_run > 0) { if (byte_run > 0) {
palette_idx1 = bytestream2_get_byte(&g2); palette_idx1 = bytestream2_get_byte(&g2);
CHECK_PIXEL_PTR(byte_run); CHECK_PIXEL_PTR(byte_run);