X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Frscc.c;h=bd0520950ff323164344d4a0f73a3ea9f60ff5a6;hb=ed0001482a74b60f3d5bc5cd7e304c9d65b2fcd5;hp=7d4e842cd3f81b52c788f81258616a8e2abd1781;hpb=f05f210526a3dc2d9fa6b1c228e3907ebd1d43c6;p=ffmpeg diff --git a/libavcodec/rscc.c b/libavcodec/rscc.c index 7d4e842cd3f..bd0520950ff 100644 --- a/libavcodec/rscc.c +++ b/libavcodec/rscc.c @@ -199,6 +199,12 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data, /* If necessary, uncompress tiles, and hijack the bytestream reader */ if (packed_tiles_size != tiles_nb * TILE_SIZE) { uLongf length = tiles_nb * TILE_SIZE; + + if (bytestream2_get_bytes_left(gbc) < packed_tiles_size) { + ret = AVERROR_INVALIDDATA; + goto end; + } + inflated_tiles = av_malloc(length); if (!inflated_tiles) { ret = AVERROR(ENOMEM); @@ -304,7 +310,7 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data, } /* Allocate when needed */ - ret = ff_reget_buffer(avctx, ctx->reference); + ret = ff_reget_buffer(avctx, ctx->reference, 0); if (ret < 0) goto end;