diff options
author | Dominik Röttsches <drott@chromium.org> | 2022-08-26 12:08:34 +0300 |
---|---|---|
committer | Dominik Röttsches <drott@chromium.org> | 2022-08-26 12:08:34 +0300 |
commit | 4797b2ff22906ce4ff4e6dcee300a70f94dcc43a (patch) | |
tree | 6e66d7bbdc8dd233721c1fed17f73b774d70fb16 | |
parent | 395da3d72ac5186fdf68fb450bba1d57515fce1e (diff) | |
download | freetype2-4797b2ff22906ce4ff4e6dcee300a70f94dcc43a.tar.gz |
[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
-rw-r--r-- | src/sfnt/ttcolr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sfnt/ttcolr.c b/src/sfnt/ttcolr.c index 25051a49c..1277bbd53 100644 --- a/src/sfnt/ttcolr.c +++ b/src/sfnt/ttcolr.c @@ -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 |