Use multiplication to avoid undefined behaviour per clang

Newer versions of MSVC with /we4146 don't like putting negative sign behind a
unsigned number as https://github.com/harfbuzz/harfbuzz/pull/2069
That however have made https://crbug.com/1050424 this complain:
  src/hb-ot-color-sbix-table.hh:304:28: runtime error: negation of -2147483648 cannot be represented in type 'int';
                                        cast to an unsigned type to negate this value to itself
which apparently can be fixed using this change.

Let's see if this won't make another ubsan complain!
This commit is contained in:
Ebrahim Byagowi 2020-02-11 19:50:51 +03:30
parent 21e1b1310a
commit ff984ed3cd
2 changed files with 1 additions and 1 deletions

View File

@ -301,7 +301,7 @@ struct sbix
extents->x_bearing = x_offset; extents->x_bearing = x_offset;
extents->y_bearing = png.IHDR.height + y_offset; extents->y_bearing = png.IHDR.height + y_offset;
extents->width = png.IHDR.width; extents->width = png.IHDR.width;
extents->height = -static_cast<int>(png.IHDR.height); extents->height = -1 * png.IHDR.height;
/* Convert to font units. */ /* Convert to font units. */
if (strike_ppem) if (strike_ppem)