diff --git a/0001-Fix-UB-in-pred_max-test.patch b/0001-Fix-UB-in-pred_max-test.patch new file mode 100644 index 0000000..852a238 --- /dev/null +++ b/0001-Fix-UB-in-pred_max-test.patch @@ -0,0 +1,27 @@ +From 1596b669d73579c22c8fbd1cd2ef0743bb50fdce Mon Sep 17 00:00:00 2001 +From: Fabio Valentini +Date: Fri, 13 Jan 2023 17:35:44 +0100 +Subject: [PATCH] Fix UB in pred_max test + +Backport of upstream commit: +https://github.com/xiph/rav1e/commit/d56fe642bbbd8fe3d20c851b950db3fcaea53c7a +--- + src/predict.rs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/predict.rs b/src/predict.rs +index 8e0108a..6058ccb 100644 +--- a/src/predict.rs ++++ b/src/predict.rs +@@ -1542,7 +1542,7 @@ mod test { + } + } + +- let above_left = unsafe { *above.as_ptr().offset(-1) }; ++ let above_left = max12bit; + + pred_paeth( + &mut o.as_region_mut(), +-- +2.39.0 + diff --git a/d56fe64.patch b/d56fe64.patch new file mode 100644 index 0000000..753d37e --- /dev/null +++ b/d56fe64.patch @@ -0,0 +1,23 @@ +From d56fe642bbbd8fe3d20c851b950db3fcaea53c7a Mon Sep 17 00:00:00 2001 +From: redzic <48274562+redzic@users.noreply.github.com> +Date: Thu, 29 Sep 2022 15:17:00 -0500 +Subject: [PATCH] Fix UB in pred_max test + +--- + src/predict.rs | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/predict.rs b/src/predict.rs +index 85cdd69abb..75140830db 100644 +--- a/src/predict.rs ++++ b/src/predict.rs +@@ -1558,8 +1558,7 @@ mod test { + } + } + +- // SAFETY: ??? +- let above_left = unsafe { *above.as_ptr().offset(-1) }; ++ let above_left = max12bit; + + pred_paeth( + &mut o.as_region_mut(), diff --git a/rust-rav1e.spec b/rust-rav1e.spec index aa821d7..9a51edb 100644 --- a/rust-rav1e.spec +++ b/rust-rav1e.spec @@ -34,6 +34,9 @@ Patch: rav1e-fix-metadata-auto.diff Patch: rav1e-fix-metadata.diff # * Remove useless / no-op hawktracer macros Patch: 0001-remove-unused-hawktracer-usage.patch +# * Backported patch to fix UB / crash in test code +# https://github.com/xiph/rav1e/commit/d56fe64: +Patch: 0001-Fix-UB-in-pred_max-test.patch ExclusiveArch: %{rust_arches}