freetype2/CVE-2022-27405.patch
2024-02-10 22:10:05 +08:00

19 lines
423 B
Diff

--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -2527,6 +2527,16 @@
#endif
+ /* only use lower 31 bits together with sign bit */
+ if ( face_index > 0 )
+ face_index &= 0x7FFFFFFFL;
+ else
+ {
+ face_index = -face_index;
+ face_index &= 0x7FFFFFFFL;
+ face_index = -face_index;
+ }
+
#ifdef FT_DEBUG_LEVEL_TRACE
FT_TRACE3(( "FT_Open_Face: " ));
if ( face_index < 0 )