[FFmpeg-devel] [PATCH 1/2] avcodec/mpegvideo_enc: Check FLV1 resolution limits
Alexander Strasser
eclipse7 at gmx.net
Sun Jan 12 13:31:53 EET 2025
On 2025-01-08 05:13 +0100, Michael Niedermayer wrote:
> Found-by: Elias Myllymäki <elias.myllymaki04p at gmail.com>
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
> libavcodec/mpegvideo_enc.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
> index c5f20c2d855..09df2f52a6c 100644
> --- a/libavcodec/mpegvideo_enc.c
> +++ b/libavcodec/mpegvideo_enc.c
> @@ -567,6 +567,12 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
> av_log(avctx, AV_LOG_ERROR, "H.263 does not support resolutions above 2048x1152\n");
> return AVERROR(EINVAL);
> }
> + if (s->codec_id == AV_CODEC_ID_FLV1 &&
> + (avctx->width > 65535 ||
> + avctx->height > 65535 )) {
> + av_log(avctx, AV_LOG_ERROR, "FLV does not support resolutions above 16bit\n");
> + return AVERROR(EINVAL);
> + }
> if ((s->codec_id == AV_CODEC_ID_H263 ||
> s->codec_id == AV_CODEC_ID_H263P ||
> s->codec_id == AV_CODEC_ID_RV20) &&
> --
LGTM
Just out of curiosity, did this just produce broken video streams
before this patch?
Something else only a little related to this patch, but somehow
to this one and all that came before. As this is in ff_mpv_encode_init
and there are dozens of checks like this and the whole function
is around 600 lines, it would be good to refactor this into a
more readable and potentially stronger form.
Best regards,
Alexander
More information about the ffmpeg-devel
mailing list