提交 ffde3c9f 编写于 作者: P Philip Withnall 提交者: Behdad Esfahbod

hb-font: Fix a potentially undefined use of memcmp() (#413)

While it’s fine to call memcmp(x, 0, 0) in practice, the C99 standard
explicitly says that this is not allowed: even if the length is zero,
the pointer arguments must be valid.

http://stackoverflow.com/a/16363034

Coverity ID: 141178
Signed-off-by: NPhilip Withnall <withnall@endlessm.com>
上级 09594df1
......@@ -1596,7 +1596,8 @@ _hb_font_adopt_var_coords_normalized (hb_font_t *font,
unsigned int coords_length)
{
if (font->num_coords == coords_length &&
0 == memcmp (font->coords, coords, coords_length * sizeof (coords[0])))
(coords_length == 0 ||
0 == memcmp (font->coords, coords, coords_length * sizeof (coords[0]))))
{
free (coords);
return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册