Thu Aug 11 11:43:32 2005 Søren Sandmann <sandmann@redhat.com>
Make sure we don't crash on glyphs with NULL bits. Bug 659.
This commit is contained in:
parent
3e471ddf1d
commit
13e16ee93a
|
@ -253,6 +253,7 @@ XAAGlyphBltTEColorExpansion(
|
||||||
RightEdge = min(Right, pbox->x2);
|
RightEdge = min(Right, pbox->x2);
|
||||||
|
|
||||||
if(RightEdge > LeftEdge) { /* we have something to draw */
|
if(RightEdge > LeftEdge) { /* we have something to draw */
|
||||||
|
unsigned int *fallbackBits = NULL;
|
||||||
ytop = max(Top, pbox->y1);
|
ytop = max(Top, pbox->y1);
|
||||||
ybot = min(Bottom, pbox->y2);
|
ybot = min(Bottom, pbox->y2);
|
||||||
|
|
||||||
|
@ -265,9 +266,22 @@ XAAGlyphBltTEColorExpansion(
|
||||||
int count;
|
int count;
|
||||||
glyphs = (unsigned int**)(infoRec->PreAllocMem);
|
glyphs = (unsigned int**)(infoRec->PreAllocMem);
|
||||||
|
|
||||||
for(count = 0; count < nglyph; count++)
|
for(count = 0; count < nglyph; count++) {
|
||||||
glyphs[count] = (unsigned int*)
|
glyphs[count] = (unsigned int*)
|
||||||
FONTGLYPHBITS(gBase,*ppci++);
|
FONTGLYPHBITS(gBase,*ppci++);
|
||||||
|
if (!glyphs[count]) {
|
||||||
|
/* Glyphs with NULL bits do exist in the wild.
|
||||||
|
Replace with blank bits in that case */
|
||||||
|
|
||||||
|
if (!fallbackBits) {
|
||||||
|
int fontHeight = Bottom - Top + 1;
|
||||||
|
fallbackBits = xcalloc (glyphWidth * fontHeight, 1);
|
||||||
|
if (!fallbackBits)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glyphs[count] = fallbackBits;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* our new unrolled TE code only writes DWORDS at a time
|
/* our new unrolled TE code only writes DWORDS at a time
|
||||||
so it can read up to 6 characters past the last one
|
so it can read up to 6 characters past the last one
|
||||||
|
@ -286,6 +300,9 @@ XAAGlyphBltTEColorExpansion(
|
||||||
LeftEdge, ytop, RightEdge - LeftEdge, ybot - ytop,
|
LeftEdge, ytop, RightEdge - LeftEdge, ybot - ytop,
|
||||||
skippix, ytop - Top, glyphs + skipglyphs, glyphWidth,
|
skippix, ytop - Top, glyphs + skipglyphs, glyphWidth,
|
||||||
fg, bg, rop, planemask);
|
fg, bg, rop, planemask);
|
||||||
|
|
||||||
|
if (fallbackBits)
|
||||||
|
xfree (fallbackBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
nbox--; pbox++;
|
nbox--; pbox++;
|
||||||
|
|
Loading…
Reference in New Issue