1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-29 05:57:37 +02:00

avcodec/mjpegdec: Move reference dimension check to mxpegdec.c

Only the mxpeg sets reference at all.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-09-12 04:03:07 +02:00
parent b5cfabf0f5
commit f33e62a8b4
2 changed files with 6 additions and 9 deletions

View File

@@ -1678,15 +1678,6 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask,
return -1;
}
if (reference) {
if (reference->width != s->picture_ptr->width ||
reference->height != s->picture_ptr->height ||
reference->format != s->picture_ptr->format) {
av_log(s->avctx, AV_LOG_ERROR, "Reference mismatching\n");
return AVERROR_INVALIDDATA;
}
}
/* XXX: verify len field validity */
len = get_bits(&s->gb, 16);
nb_components = get_bits(&s->gb, 8);

View File

@@ -179,6 +179,12 @@ static int mxpeg_check_dimensions(MXpegDecodeContext *s, MJpegDecodeContext *jpg
return AVERROR(EINVAL);
}
}
if (reference_ptr->width != jpg->picture_ptr->width ||
reference_ptr->height != jpg->picture_ptr->height ||
reference_ptr->format != jpg->picture_ptr->format) {
av_log(jpg->avctx, AV_LOG_ERROR, "Reference mismatching\n");
return AVERROR_INVALIDDATA;
}
}
return 0;