Commit 489c575b authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/ivi_common: make while get_bits loop more robust by checking bits left

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 4b12930f
......@@ -1042,7 +1042,12 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
*/
if (avctx->codec_id == AV_CODEC_ID_INDEO4 &&
ctx->frame_type == 0/*FRAMETYPE_INTRA*/) {
while (get_bits(&ctx->gb, 8)); // skip version string
// skip version string
while (get_bits(&ctx->gb, 8)) {
if (get_bits_left(&ctx->gb) < 8)
return AVERROR_INVALIDDATA;
}
skip_bits_long(&ctx->gb, 64); // skip padding, TODO: implement correct 8-bytes alignment
if (get_bits_left(&ctx->gb) > 18 && show_bits(&ctx->gb, 18) == 0x3FFF8)
av_log(avctx, AV_LOG_ERROR, "Buffer contains IP frames!\n");
......
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