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