type = AV_RB32(avpkt->data);
size = AV_RL32(avpkt->data + 4);
+ if (size < 1 || size >= avpkt->size)
+ return AVERROR_INVALIDDATA;
+
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
for (int i = 0; i < s->nb_symbols; symbol++) {
int prob;
+ if (get_bits_left(gb) < 4)
+ return AVERROR_INVALIDDATA;
+
if (get_bits1(gb)) {
prob = get_bits(gb, 12);
} else {
dst = frame->data[p] + (avctx->height - 1) * frame->linesize[p];
for (int y = 0; y < avctx->height; y++) {
+ if (get_bits_left(gb) < width)
+ return AVERROR_INVALIDDATA;
for (int x = 0; x < width; x++) {
int v = get_vlc2(gb, s->vlc.table, s->vlc.bits, 3);
dst = frame->data[p] + (avctx->height - 1) * frame->linesize[p];
s->llviddsp.add_left_pred(dst, dst, width, 0);
- dst -= stride;
- lefttop = left = dst[0];
- for (int y = 1; y < avctx->height; y++) {
- s->llviddsp.add_median_pred(dst, dst + stride, dst, width, &left, &lefttop);
- lefttop = left = dst[0];
+ if (avctx->height > 1) {
dst -= stride;
+ lefttop = left = dst[0];
+ for (int y = 1; y < avctx->height; y++) {
+ s->llviddsp.add_median_pred(dst, dst + stride, dst, width, &left, &lefttop);
+ lefttop = left = dst[0];
+ dst -= stride;
+ }
}
}
return 0;
}
-AVCodec ff_mvha_decoder = {
+const AVCodec ff_mvha_decoder = {
.name = "mvha",
.long_name = NULL_IF_CONFIG_SMALL("MidiVid Archive Codec"),
.type = AVMEDIA_TYPE_VIDEO,