X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Ffic.c;h=457d74d7cda855715330e598e8fd04851ab7cb2f;hb=4e8d22478bc854949a9adbda97348f2997e1dc8d;hp=65d102b86bea25f8bdc982889c50b2277342710b;hpb=0c126431f9b290f5651ec62f45627632d94c51ea;p=ffmpeg diff --git a/libavcodec/fic.c b/libavcodec/fic.c index 65d102b86be..457d74d7cda 100644 --- a/libavcodec/fic.c +++ b/libavcodec/fic.c @@ -22,6 +22,7 @@ */ #include "libavutil/common.h" +#include "libavutil/mem_internal.h" #include "libavutil/opt.h" #include "avcodec.h" #include "internal.h" @@ -278,7 +279,7 @@ static int fic_decode_frame(AVCodecContext *avctx, void *data, int skip_cursor = ctx->skip_cursor; uint8_t *sdata; - if ((ret = ff_reget_buffer(avctx, ctx->frame)) < 0) + if ((ret = ff_reget_buffer(avctx, ctx->frame, 0)) < 0) return ret; /* Header + at least one slice (4) */ @@ -356,7 +357,7 @@ static int fic_decode_frame(AVCodecContext *avctx, void *data, sdata = src + tsize + FIC_HEADER_SIZE + 4 * nslices; msize = avpkt->size - nslices * 4 - tsize - FIC_HEADER_SIZE; - if (msize <= 0) { + if (msize <= ctx->aligned_width/8 * (ctx->aligned_height/8) / 8) { av_log(avctx, AV_LOG_ERROR, "Not enough frame data to decode.\n"); return AVERROR_INVALIDDATA; } @@ -421,7 +422,7 @@ static int fic_decode_frame(AVCodecContext *avctx, void *data, } /* Make sure we use a user-supplied buffer. */ - if ((ret = ff_reget_buffer(avctx, ctx->final_frame)) < 0) { + if ((ret = ff_reget_buffer(avctx, ctx->final_frame, 0)) < 0) { av_log(avctx, AV_LOG_ERROR, "Could not make frame writable.\n"); return ret; } @@ -482,7 +483,7 @@ static const AVClass fic_decoder_class = { .version = LIBAVUTIL_VERSION_INT, }; -AVCodec ff_fic_decoder = { +const AVCodec ff_fic_decoder = { .name = "fic", .long_name = NULL_IF_CONFIG_SMALL("Mirillis FIC"), .type = AVMEDIA_TYPE_VIDEO,