nanogui: Small "bug" in FreeType 1 support (engine/font_freetype.c)
Subject:
Small "bug" in FreeType 1 support (engine/font_freetype.c)
From:
"Paul Bartholomew" ####@####.####
Date:
11 Jul 2005 21:53:42 +0100
Message-Id: <BAY108-F24D3D0EBD5928DA928AE10EFDC0@phx.gbl>
FYI -
There's a small "bug" in "engine/font_freetype.c". In the function
"drawchar()", it's possible for width/height to both be "0" (example: when
drawing the SPACE character). This results in a malloc of zero bytes.
It can be argued that a malloc of zero bytes is 'legal', but I wouldn't be
surprised if certain implementations consider it an error.
I think the code in drawchar should be changed to return if either
width/height are zero:
/* we begin by grid-fitting the bounding box */
TT_Get_Glyph_Outline (pf->glyph, &outline);
TT_Get_Outline_BBox (&outline, &bbox);
xmin = (bbox.xMin & -64) >> 6;
ymin = (bbox.yMin & -64) >> 6;
xmax = ((bbox.xMax + 63) & -64) >> 6;
ymax = ((bbox.yMax + 63) & -64) >> 6;
width = xmax - xmin;
height = ymax - ymin;
size = width * height;
if (!size) {
return;
}
- Paul