[sfnt] Avoid undefined shifts in COLR v1 color line retrieval

* src/sfnt/ttcolr.c (tt_face_get_colorline_stops): Disambiguate shift
behavior by using multiplication using macros from ftcalc.h.

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50573
This commit is contained in:
Dominik Röttsches 2022-08-26 12:08:34 +03:00
parent 395da3d72a
commit 4797b2ff22

View File

@ -1575,7 +1575,7 @@
/* Iterator points at first `ColorStop` of `ColorLine`. */
p = iterator->p;
color_stop->stop_offset = (FT_Fixed)FT_NEXT_SHORT( p ) << 2;
color_stop->stop_offset = F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) );
color_stop->color.palette_index = FT_NEXT_USHORT( p );
@ -1600,7 +1600,7 @@
item_deltas ) )
return 0;
color_stop->stop_offset += (FT_Fixed)item_deltas[0] << 2;
color_stop->stop_offset += F2DOT14_TO_FIXED( item_deltas[0] );
color_stop->color.alpha += item_deltas[1];
}
#else