Backport upstream patch to fix UB / crash in test code

This commit is contained in:
Fabio Valentini 2023-01-13 17:44:30 +01:00
parent 72cd36f806
commit bf42ca2e8f
No known key found for this signature in database
GPG Key ID: 5AC5F572E5D410AF
3 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,27 @@
From 1596b669d73579c22c8fbd1cd2ef0743bb50fdce Mon Sep 17 00:00:00 2001
From: Fabio Valentini <decathorpe@gmail.com>
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

23
d56fe64.patch Normal file
View File

@ -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(),

View File

@ -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}