X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fcavsdec.c;h=099599ae510b59f4511de854ba700a4c4d59fb68;hb=2b02bc64226ad645e6f97f955bff3fcaf731b25a;hp=a4645127734b217f8a4b1761847284a12d24be62;hpb=86e107a7d468666189506d3edd4f4b5ca14cd59e;p=ffmpeg diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c index a4645127734..099599ae510 100644 --- a/libavcodec/cavsdec.c +++ b/libavcodec/cavsdec.c @@ -25,6 +25,7 @@ * @author Stefan Gehrer */ +#include "libavutil/avassert.h" #include "avcodec.h" #include "get_bits.h" #include "golomb.h" @@ -372,7 +373,7 @@ static void decode_mb_b(AVSContext *h, enum cavs_mb mb_type) { } break; default: - assert((mb_type > B_SYM_16X16) && (mb_type < B_8X8)); + av_assert2((mb_type > B_SYM_16X16) && (mb_type < B_8X8)); flags = ff_cavs_partition_flags[mb_type]; if(mb_type & 1) { /* 16x8 macroblock types */ if(flags & FWD0) @@ -624,6 +625,10 @@ static int decode_seq_header(AVSContext *h) { av_log_missing_feature(s, "Width/height changing in CAVS is", 0); return -1; } + if (width <= 0 || height <= 0) { + av_log(s, AV_LOG_ERROR, "Dimensions invalid\n"); + return AVERROR_INVALIDDATA; + } s->width = width; s->height = height; skip_bits(&s->gb,2); //chroma format @@ -732,12 +737,12 @@ static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size, AVCodec ff_cavs_decoder = { .name = "cavs", .type = AVMEDIA_TYPE_VIDEO, - .id = CODEC_ID_CAVS, + .id = AV_CODEC_ID_CAVS, .priv_data_size = sizeof(AVSContext), .init = ff_cavs_init, .close = ff_cavs_end, .decode = cavs_decode_frame, .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY, .flush = cavs_flush, - .long_name = NULL_IF_CONFIG_SMALL("Chinese AVS video (AVS1-P2, JiZhun profile)"), + .long_name = NULL_IF_CONFIG_SMALL("Chinese AVS (Audio Video Standard) (AVS1-P2, JiZhun profile)"), };