From: James Almer via ffmpeg-devel <ffmpeg-devel@ffmpeg.org> To: ffmpeg-devel@ffmpeg.org Cc: James Almer <code@ffmpeg.org> Subject: [FFmpeg-devel] [PATCH] avformat/matroskadec: relax the check for cropped dimensions (PR #20653) Date: Mon, 06 Oct 2025 13:26:59 -0000 Message-ID: <175975721977.65.8535338401202285423@bf249f23a2c8> (raw) PR #20653 opened by James Almer (jamrial) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20653 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20653.patch There seem to be samples with no Video element on video tracks in the wild, which even if not spec compliant, can be demuxed fine after lavf probes the stream with a decoder/parser. Relax the check to allow tracks with no dimensions to work, and also add a check for strict spec compliance to maintain the current behavior if desired. Fixes issue #20649. >From 0de01622dd901e78a1d6a4faef0f18afba537667 Mon Sep 17 00:00:00 2001 From: James Almer <jamrial@gmail.com> Date: Mon, 6 Oct 2025 10:21:03 -0300 Subject: [PATCH] avformat/matroskadec: relax the check for cropped dimensions There seem to be samples with no Video element on video tracks in the wild, which even if not spec compliant, can be demuxed fine after lavf probes the stream with a decoder/parser. Relax the check to allow tracks with no dimensions to work, and also add a check for strict spec compliance to maintain the current behavior if desired. Fixes issue #20649. Signed-off-by: James Almer <jamrial@gmail.com> --- libavformat/matroskadec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 6c12e1594c..c4190cc059 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -3168,10 +3168,13 @@ static int matroska_parse_tracks(AVFormatContext *s) track->default_duration = default_duration; } } + if (matroska->ctx->strict_std_compliance >= FF_COMPLIANCE_STRICT && + (!track->video.pixel_width || !track->video.pixel_height)) + return AVERROR_INVALIDDATA; if (track->video.pixel_cropl >= INT_MAX - track->video.pixel_cropr || track->video.pixel_cropt >= INT_MAX - track->video.pixel_cropb || - (track->video.pixel_cropl + track->video.pixel_cropr) >= track->video.pixel_width || - (track->video.pixel_cropt + track->video.pixel_cropb) >= track->video.pixel_height) + (track->video.pixel_cropl + track->video.pixel_cropr) >= track->video.pixel_width + !track->video.pixel_width || + (track->video.pixel_cropt + track->video.pixel_cropb) >= track->video.pixel_height + !track->video.pixel_height) return AVERROR_INVALIDDATA; track->video.cropped_width = track->video.pixel_width - track->video.pixel_cropl - track->video.pixel_cropr; -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
reply other threads:[~2025-10-06 13:27 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=175975721977.65.8535338401202285423@bf249f23a2c8 \ --to=ffmpeg-devel@ffmpeg.org \ --cc=code@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror http://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ http://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git