From bb41b74fd1fb42b08e9069c22ee046daeee98e6b Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Wed, 18 Sep 2019 00:55:24 +0430 Subject: [PATCH] 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::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, 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) --- src/hb-ft.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-ft.cc b/src/hb-ft.cc index 19c49283d..e526bf40d 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -866,7 +866,7 @@ hb_ft_font_set_funcs (hb_font_t *font) if (ft_coords) { 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); free (ft_coords); }