#120047 crash while loading http://www.lupa.cz/anketa.phtml [@ ReadCMAPTableFormat4]

r=rbs, sr=waterson, a=dbaron


git-svn-id: svn://10.0.0.236/trunk@112362 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
shanjian%netscape.com
2002-01-17 00:03:03 +00:00
parent 90b5568a5d
commit 33121badfe

View File

@@ -1344,7 +1344,7 @@ ReadCMAPTableFormat12(PRUint8* aBuf, PRInt32 len, PRUint32 **aExtMap)
static void
ReadCMAPTableFormat4(PRUint8* aBuf, PRInt32 aLength, PRUint32* aMap, PRUint8* aIsSpace)
ReadCMAPTableFormat4(PRUint8* aBuf, PRInt32 aLength, PRUint32* aMap, PRUint8* aIsSpace, PRUint32 aMaxGlyph)
{
PRUint8* p = aBuf;
PRUint8* end = aBuf + aLength;
@@ -1376,13 +1376,15 @@ ReadCMAPTableFormat4(PRUint8* aBuf, PRInt32 aLength, PRUint32* aMap, PRUint8* aI
if ((PRUint8*) g < end) {
if (*g) {
PRUint16 glyph = idDelta[i] + *g;
if (aIsSpace[glyph]) {
if (SHOULD_BE_SPACE_CHAR(c)) {
if (glyph < aMaxGlyph) {
if (aIsSpace[glyph]) {
if (SHOULD_BE_SPACE_CHAR(c)) {
ADD_GLYPH(aMap, c);
}
}
else {
ADD_GLYPH(aMap, c);
}
}
else {
ADD_GLYPH(aMap, c);
}
}
}
else {
@@ -1505,7 +1507,7 @@ nsFontMetricsWin::GetFontCCMAP(HDC aDC, const char* aShortName, eFontType& aFont
PRUint32 maxGlyph;
nsAutoFontDataBuffer isSpace;
if (NS_SUCCEEDED(GetSpaces(aDC, &maxGlyph, isSpace))) {
ReadCMAPTableFormat4(buf+keepOffset, len-keepOffset, map, isSpace.GetArray());
ReadCMAPTableFormat4(buf+keepOffset, len-keepOffset, map, isSpace.GetArray(), maxGlyph);
ccmap = MapToCCMap(map);
aCharset = DEFAULT_CHARSET;
aFontType = eFontType_Unicode;