diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-10-30 14:23:30 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-10-30 14:59:00 +0100 |
commit | 489c575bd6f8d5e6ac2e9106b7efa7e25a68f478 (patch) | |
tree | 29aa6d070f7d2c11fe22a1595cc5fa5d91a99cc3 /libavcodec/ivi_common.c | |
parent | 4b12930f79eda58f522f8449e67769f1b2b012d7 (diff) | |
download | ffmpeg-489c575bd6f8d5e6ac2e9106b7efa7e25a68f478.tar.gz |
avcodec/ivi_common: make while get_bits loop more robust by checking bits left
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ivi_common.c')
-rw-r--r-- | libavcodec/ivi_common.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/ivi_common.c b/libavcodec/ivi_common.c index 4179852d7b..ab4c9958c4 100644 --- a/libavcodec/ivi_common.c +++ b/libavcodec/ivi_common.c @@ -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"); |