commit: 7175b838fce852b050cc031dcb5141d8499cb539 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> AuthorDate: Sun Oct 8 12:21:15 2023 +0000 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> CommitDate: Sun Oct 8 14:37:30 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7175b838
media-libs/mlt: Backport crash fixes post-7.20 release Upstream commits: 482f1fb0179587575b3071f622df51a95895068a 09f55bf3d1fdcac06c5d297bb27cb4f3e7f85021 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> .../mlt/files/mlt-7.20.0-qtblend-crash.patch | 43 ++++++++++++++++++++++ .../mlt/files/mlt-7.20.0-rotoscoping-crash.patch | 22 +++++++++++ media-libs/mlt/mlt-7.20.0.ebuild | 3 ++ 3 files changed, 68 insertions(+) diff --git a/media-libs/mlt/files/mlt-7.20.0-qtblend-crash.patch b/media-libs/mlt/files/mlt-7.20.0-qtblend-crash.patch new file mode 100644 index 000000000000..aad8f0e9e45c --- /dev/null +++ b/media-libs/mlt/files/mlt-7.20.0-qtblend-crash.patch @@ -0,0 +1,43 @@ +From 09f55bf3d1fdcac06c5d297bb27cb4f3e7f85021 Mon Sep 17 00:00:00 2001 +From: Jean-Baptiste Mardelle <[email protected]> +Date: Thu, 5 Oct 2023 08:45:16 +0200 +Subject: [PATCH] Ensure qtblend doesn't request an image of 0 width or height + (crashes many filters) + +--- + src/modules/qt/filter_qtblend.cpp | 6 +++--- + src/modules/qt/transition_qtblend.cpp | 3 +++ + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/src/modules/qt/filter_qtblend.cpp b/src/modules/qt/filter_qtblend.cpp +index d54f7ccad..32d752d60 100644 +--- a/src/modules/qt/filter_qtblend.cpp ++++ b/src/modules/qt/filter_qtblend.cpp +@@ -103,10 +103,10 @@ static int filter_get_image(mlt_frame frame, + || rect.h != *height; + + if (mlt_properties_get_int(properties, "distort") == 0) { +- b_height = qMin((int) rect.h, b_height); +- b_width = b_height * b_dar / b_ar / consumer_ar; ++ b_height = qMax(1, qMin((int) rect.h, b_height)); ++ b_width = qMax(1, int(b_height * b_dar / b_ar / consumer_ar)); + } else { +- b_width *= b_ar / consumer_ar; ++ b_width = qMax(1, int(b_width * b_ar / consumer_ar)); + } + if (!hasAlpha && (b_width < *width || b_height < *height)) { + hasAlpha = true; +diff --git a/src/modules/qt/transition_qtblend.cpp b/src/modules/qt/transition_qtblend.cpp +index 9dbc795aa..0b41b3ff8 100644 +--- a/src/modules/qt/transition_qtblend.cpp ++++ b/src/modules/qt/transition_qtblend.cpp +@@ -121,6 +121,9 @@ static int get_image(mlt_frame a_frame, + // we will process operations on top frame, so also process b_frame + forceAlpha = true; + } ++ // Ensure we don't request an image with a 0 width or height ++ b_width = qMax(1, b_width); ++ b_height = qMax(1, b_height); + } else { + b_height = *height; + b_width = *width; diff --git a/media-libs/mlt/files/mlt-7.20.0-rotoscoping-crash.patch b/media-libs/mlt/files/mlt-7.20.0-rotoscoping-crash.patch new file mode 100644 index 000000000000..124e1102b6d2 --- /dev/null +++ b/media-libs/mlt/files/mlt-7.20.0-rotoscoping-crash.patch @@ -0,0 +1,22 @@ +From 482f1fb0179587575b3071f622df51a95895068a Mon Sep 17 00:00:00 2001 +From: Jean-Baptiste Mardelle <[email protected]> +Date: Wed, 4 Oct 2023 22:26:13 +0200 +Subject: [PATCH] Fix rotoscoping filter crash on image with height = 0 + +--- + src/modules/plusgpl/filter_rotoscoping.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/modules/plusgpl/filter_rotoscoping.c b/src/modules/plusgpl/filter_rotoscoping.c +index 35e3931f0..782c39422 100644 +--- a/src/modules/plusgpl/filter_rotoscoping.c ++++ b/src/modules/plusgpl/filter_rotoscoping.c +@@ -337,7 +337,7 @@ static int filter_get_image(mlt_frame frame, + int offsetx = 0; + int offsety = 0; + // Compare aspect ratio +- if (100 * *width / *height != 100 * normalized_width / normalized_height) { ++ if (*height > 0 && 100 * *width / *height != 100 * normalized_width / normalized_height) { + // Source has a different aspect ratio, apply scaling + double xfactor = normalized_width / *width; + double yfactor = normalized_height / *height; diff --git a/media-libs/mlt/mlt-7.20.0.ebuild b/media-libs/mlt/mlt-7.20.0.ebuild index db7be1c8207b..b84f4931436a 100644 --- a/media-libs/mlt/mlt-7.20.0.ebuild +++ b/media-libs/mlt/mlt-7.20.0.ebuild @@ -82,9 +82,12 @@ BDEPEND=" DOCS=( AUTHORS NEWS README.md ) PATCHES=( + # downstream "${FILESDIR}"/${PN}-6.10.0-swig-underlinking.patch "${FILESDIR}"/${PN}-6.22.1-no_lua_bdepend.patch "${FILESDIR}"/${PN}-7.0.1-cmake-symlink.patch + # upstream (>=7.21.0) + "${FILESDIR}"/${P}-{rotoscoping,qtblend}-crash.patch ) pkg_setup() {
