mirror of
https://github.com/freetype/freetype.git
synced 2026-01-18 00:11:18 +01:00
[base] Set ppem-based rendering limits.
This will not eliminate all rendering timeouts. It is still possible to scribble excessively within the set limits. At least, the memory usage will be curtained. * src/base/ftobjs.c (ft_glyphslot_free_bitmap): Revise limits base on ppem when available.
This commit is contained in:
@@ -524,12 +524,20 @@
|
||||
bitmap->rows = (unsigned int)height;
|
||||
bitmap->pitch = pitch;
|
||||
|
||||
if ( pbox.xMin < -0x8000 || pbox.xMax > 0x7FFF ||
|
||||
pbox.yMin < -0x8000 || pbox.yMax > 0x7FFF )
|
||||
/* sanity check */
|
||||
{
|
||||
FT_TRACE3(( "ft_glyphslot_preset_bitmap: [%ld %ld %ld %ld]\n",
|
||||
pbox.xMin, pbox.yMin, pbox.xMax, pbox.yMax ));
|
||||
return 1;
|
||||
FT_Face face = slot->face;
|
||||
FT_Pos xlim = face ? 16 * face->size->metrics.x_ppem : 0x8000;
|
||||
FT_Pos ylim = face ? 16 * face->size->metrics.y_ppem : 0x8000;
|
||||
|
||||
|
||||
if ( pbox.xMin < -xlim || pbox.xMax > xlim ||
|
||||
pbox.yMin < -ylim || pbox.yMax > ylim )
|
||||
{
|
||||
FT_TRACE3(( "ft_glyphslot_preset_bitmap: [%ld %ld %ld %ld]\n",
|
||||
pbox.xMin, pbox.yMin, pbox.xMax, pbox.yMax ));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user