Blame SOURCES/freetype-2.9.1-properly-guard-face-index.patch

75216e
From 22a0cccb4d9d002f33c1ba7a4b36812c7d4f46b5 Mon Sep 17 00:00:00 2001
75216e
From: Werner Lemberg <wl@gnu.org>
75216e
Date: Sat, 19 Mar 2022 06:40:17 +0100
75216e
Subject: [PATCH] * src/base/ftobjs.c (ft_open_face_internal): Properly guard
75216e
 `face_index`.
75216e
75216e
We must ensure that the cast to `FT_Int` doesn't change the sign.
75216e
75216e
Fixes #1139.
75216e
---
75216e
 src/base/ftobjs.c | 9 +++++++++
75216e
 1 file changed, 9 insertions(+)
75216e
75216e
From d014387ad4a5dd04d8e7f99587c7dacb70261924 Mon Sep 17 00:00:00 2001
75216e
From: Werner Lemberg <wl@gnu.org>
75216e
Date: Sat, 19 Mar 2022 09:30:45 +0100
75216e
Subject: [PATCH 2/2] * src/base/ftobjs.c (ft_open_face_internal): Thinko.
75216e
75216e
---
75216e
 src/base/ftobjs.c | 1 +
75216e
 1 file changed, 1 insertion(+)
75216e
75216e
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
75216e
index 2c0f0e6c9..10952a6c6 100644
75216e
--- a/src/base/ftobjs.c
75216e
+++ b/src/base/ftobjs.c
75216e
@@ -2527,6 +2527,16 @@
75216e
 #endif
75216e
 
75216e
 
75216e
+    /* only use lower 31 bits together with sign bit */
75216e
+    if ( face_index > 0 )
75216e
+      face_index &= 0x7FFFFFFFL;
75216e
+    else
75216e
+    {
75216e
+      face_index  = -face_index;
75216e
+      face_index &= 0x7FFFFFFFL;
75216e
+      face_index  = -face_index;
75216e
+    }
75216e
+
75216e
 #ifdef FT_DEBUG_LEVEL_TRACE
75216e
     FT_TRACE3(( "FT_Open_Face: " ));
75216e
     if ( face_index < 0 )
75216e
-- 
75216e
2.35.1
75216e