mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-28 17:19:17 +01:00
[font] Fix undefined-behavior when scales are negative
Fixes https://github.com/harfbuzz/harfbuzz/issues/3555
This commit is contained in:
1 parent
fc4d42ff99
commit
cd05d187c8
1 file changed
+4
-2
+4
-2
@@ -631,8 +631,10 @@ struct hb_font_t
|
||||
void mults_changed ()
|
||||
{
|
||||
signed upem = face->get_upem ();
|
||||
x_mult = ((int64_t) x_scale << 16) / upem;
|
||||
y_mult = ((int64_t) y_scale << 16) / upem;
|
||||
bool x_neg = x_scale < 0;
|
||||
x_mult = (x_neg ? -((int64_t) -x_scale << 16) : ((int64_t) x_scale << 16)) / upem;
|
||||
bool y_neg = y_scale < 0;
|
||||
y_mult = (y_neg ? -((int64_t) -y_scale << 16) : ((int64_t) y_scale << 16)) / upem;
|
||||
slant_xy = y_scale ? slant * x_scale / y_scale : 0.f;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user