提交 682db81c 编写于 作者: B Behdad Esfahbod 提交者: Behdad Esfahbod

Protect against possible division by zeros (#316468, Steve Grubb)

2005-11-23  Behdad Esfahbod  <behdad@gnome.org>

        Protect against possible division by zeros (#316468, Steve Grubb)

        * pango/pango-context.c (update_metrics_from_items),
        pango/pango-fontset.c (pango_fontset_real_get_metrics): If count is
        zero, do not alter approximate_{char,digit}_width.

        * pango/opentype/disasm.c: Err on invalid DeltaFormat.
上级 e6e15352
......@@ -444,18 +444,26 @@ Dump_Device (TTO_Device *Device, FILE *stream, int indent, FT_Bool is_gsub)
break;
}
n_per = 16 / bits;
mask = (1 << bits) - 1;
mask = mask << (16 - bits);
DUMP ("<DeltaValue>");
for (i = Device->StartSize; i <= Device->EndSize ; i++)
if (!bits)
{
fprintf(stderr, "invalid DeltaFormat!!!!!\n");
}
else
{
FT_UShort val = Device->DeltaValue[i / n_per];
FT_Short signed_val = ((val << ((i % n_per) * bits)) & mask);
dump (stream, indent, "%d", signed_val >> (16 - bits));
if (i != Device->EndSize)
DUMP (", ");
n_per = 16 / bits;
mask = (1 << bits) - 1;
mask = mask << (16 - bits);
for (i = Device->StartSize; i <= Device->EndSize ; i++)
{
FT_UShort val = Device->DeltaValue[i / n_per];
FT_Short signed_val = ((val << ((i % n_per) * bits)) & mask);
dump (stream, indent, "%d", signed_val >> (16 - bits));
if (i != Device->EndSize)
DUMP (", ");
}
}
DUMP ("</DeltaValue>\n");
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册