The branch, master has been updated
via e10473f13ec6dd7e19eaacc989e92b9616b014af (commit)
from ccb1865a82c7bb1bc75a486bb0423355a2daa522 (commit)
- Log -----------------------------------------------------------------
commit e10473f13ec6dd7e19eaacc989e92b9616b014af
Author: James Almer <[email protected]>
AuthorDate: Mon Oct 6 10:21:03 2025 -0300
Commit: James Almer <[email protected]>
CommitDate: Mon Oct 27 15:54:22 2025 -0300
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 <[email protected]>
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 6c12e1594c..8b5eda8213 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3168,11 +3168,20 @@ static int matroska_parse_tracks(AVFormatContext *s)
track->default_duration = default_duration;
}
}
- if (track->video.pixel_cropl >= INT_MAX - track->video.pixel_cropr
||
+ int has_dimensions = track->video.pixel_width ||
track->video.pixel_height;
+ if ((matroska->ctx->strict_std_compliance >= FF_COMPLIANCE_STRICT
&&
+ (!track->video.pixel_width || !track->video.pixel_height)) ||
+ (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 + !has_dimensions ||
+ (track->video.pixel_cropt + track->video.pixel_cropb) >=
track->video.pixel_height + !has_dimensions)) {
+ av_log(matroska->ctx, AV_LOG_ERROR,
+ "Invalid coded dimensions %"PRId64"x%"PRId64"
[%"PRId64", %"PRId64", %"PRId64", %"PRId64"].\n",
+ track->video.pixel_width, track->video.pixel_height,
+ track->video.pixel_cropl, track->video.pixel_cropr,
+ track->video.pixel_cropt, track->video.pixel_cropb);
return AVERROR_INVALIDDATA;
+ }
track->video.cropped_width = track->video.pixel_width -
track->video.pixel_cropl -
track->video.pixel_cropr;
track->video.cropped_height = track->video.pixel_height -
-----------------------------------------------------------------------
Summary of changes:
libavformat/matroskadec.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
hooks/post-receive
--
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]