Don't rely on undefined left shift of negative value behavior

Fixes this -fno-sanitize-recover=undefined check,

hb-ft.cc:869:27: runtime error: left shift of negative value -16384
    #0 0x7ff8f47da843 in hb_ft_font_set_funcs /home/ebrahim/Desktop/harfbuzz/src/hb-ft.cc:869:27
    #1 0x55f20a66c7d6 in font_options_t::get_font() const /home/ebrahim/Desktop/harfbuzz/util/options.cc:731:3
    #2 0x55f20a668c1f in shape_consumer_t<output_buffer_t>::init(hb_buffer_t*, font_options_t const*) /home/ebrahim/Desktop/harfbuzz/util/./shape-consumer.hh:47:42
    #3 0x55f20a668441 in main_font_text_t<shape_consumer_t<output_buffer_t>, 2147483647, 0>::main(int, char**) /home/ebrahim/Desktop/harfbuzz/util/./main-font-text.hh:75:14
    #4 0x55f20a667f91 in main /home/ebrahim/Desktop/harfbuzz/util/hb-shape.cc:180:21
    #5 0x7ff8f3df7ee2 in __libc_start_main (/usr/lib/libc.so.6+0x26ee2)
    #6 0x55f20a6427ad in _start (/home/ebrahim/Desktop/harfbuzz/util/.libs/lt-hb-shape+0xd7ad)
This commit is contained in:
Ebrahim Byagowi 2019-09-18 00:55:24 +04:30
parent b73313ade7
commit bb41b74fd1
1 changed files with 1 additions and 1 deletions

View File

@ -866,7 +866,7 @@ hb_ft_font_set_funcs (hb_font_t *font)
if (ft_coords) if (ft_coords)
{ {
for (unsigned int i = 0; i < num_coords; i++) for (unsigned int i = 0; i < num_coords; i++)
ft_coords[i] = coords[i] << 2; ft_coords[i] = coords[i] * 4;
FT_Set_Var_Blend_Coordinates (ft_face, num_coords, ft_coords); FT_Set_Var_Blend_Coordinates (ft_face, num_coords, ft_coords);
free (ft_coords); free (ft_coords);
} }