mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-22 15:31:05 +01:00
[font] Clamp synthetic emboldening strength
Computing synthetic emboldening strength could negate INT_MIN through abs() and convert an out-of-range float to int32_t. Use floating-point absolute value and clamp the rounded result to a valid position. This is part of the complete position-overflow fix for issue #6151. Testing: meson test -C build --print-errorlogs Assisted-by: Codex <codex@openai.com>
This commit is contained in:
1 parent
4c8467e823
commit
05d7cb5fec
1 file changed
+2
-2
+2
-2
@@ -1159,8 +1159,8 @@ struct hb_font_t
|
||||
|
||||
is_synthetic = x_embolden || y_embolden || slant;
|
||||
|
||||
x_strength = roundf (abs (x_scale) * x_embolden);
|
||||
y_strength = roundf (abs (y_scale) * y_embolden);
|
||||
x_strength = hb_clamp_to<int32_t> (roundf (fabsf ((float) x_scale) * x_embolden));
|
||||
y_strength = hb_clamp_to<int32_t> (roundf (fabsf ((float) y_scale) * y_embolden));
|
||||
|
||||
slant_xy = y_scale ? slant * x_scale / y_scale : 0.f;
|
||||
|
||||
|
||||
Reference in new issue
Block a user