if (s->flags & FLAG_KEYFRAME) {
/* no change bits specified for a keyframe; only index bytes */
s->index_stream = s->mb_change_bits;
+ if (s->avctx->width * s->avctx->height / 2048 + header.header_size > s->size)
+ return AVERROR_INVALIDDATA;
} else {
/* one change bit per 4x4 block */
s->index_stream = s->mb_change_bits +
/* there is a vertical predictor for each pixel in a line; each vertical
* predictor is 0 to start with */
av_fast_malloc(&s->vert_pred, &s->vert_pred_size, s->avctx->width * sizeof(unsigned int));
- if (!s->vert_pred) {
- av_frame_free(&s->frame);
+ if (!s->vert_pred)
return AVERROR(ENOMEM);
- }
return 0;
}
if ((ret = truemotion1_decode_header(s)) < 0)
return ret;
- if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+ if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
if (compression_types[s->compression].algorithm == ALGO_RGB24H) {
return 0;
}
-AVCodec ff_truemotion1_decoder = {
+const AVCodec ff_truemotion1_decoder = {
.name = "truemotion1",
.long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 1.0"),
.type = AVMEDIA_TYPE_VIDEO,
.close = truemotion1_decode_end,
.decode = truemotion1_decode_frame,
.capabilities = AV_CODEC_CAP_DR1,
+ .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};