From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 19 Mar 2022 06:40:17 +0100 Subject: [PATCH] DO NOT MERGE - Cherry-pick two upstream changes This cherry picks following two changes: 0c2bdb01a2e1d24a3e592377a6d0822856e10df2 22a0cccb4d9d002f33c1ba7a4b36812c7d4f46b5 Bug: 271680254 Test: N/A (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:4ffa271ab538f57b65a65d434a2df9d3f8cd2f4a) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:b0f8930701bf19229075cc930ad15813ff5fb07b) Merged-In: I42469df8e8b07221d64e3f8574c4f30110dbda7e Change-Id: I42469df8e8b07221d64e3f8574c4f30110dbda7e --- src/base/ftobjs.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 2b444056c..7fdf15372 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -2358,6 +2358,15 @@ #endif + /* only use lower 31 bits together with sign bit */ + if ( face_index > 0 ) + face_index &= 0x7FFFFFFFL; + else + { + face_index &= 0x7FFFFFFFL; + face_index = -face_index; + } + #ifdef FT_DEBUG_LEVEL_TRACE FT_TRACE3(( "FT_Open_Face: " )); if ( face_index < 0 ) @@ -3213,6 +3222,9 @@ if ( !face ) return FT_THROW( Invalid_Face_Handle ); + if ( !face->size ) + return FT_THROW( Invalid_Size_Handle ); + if ( !req || req->width < 0 || req->height < 0 || req->type >= FT_SIZE_REQUEST_TYPE_MAX ) return FT_THROW( Invalid_Argument );