Fix to ensure we don't go past array bounds in ScanNormalUnicodeText() b=52722 r=buster a=karnaze

This commit is contained in:
peterlubczynski%netscape.com 2000-09-22 22:45:31 +00:00
Родитель 290a07f768
Коммит 641809a1df
2 изменённых файлов: 22 добавлений и 0 удалений

Просмотреть файл

@ -438,6 +438,12 @@ nsTextTransformer::ScanNormalUnicodeText_F(PRBool aForLineBreak,
firstChar = ' ';
*aWasTransformed = PR_TRUE;
}
nsresult rv = mTransformBuf.GrowTo(mBufferPos + 1);
if (NS_FAILED(rv)) {
*aWordLen = 0;
return offset - 1;
}
mTransformBuf.mBuffer[mBufferPos++] = firstChar;
if (!breakBetween) {
@ -493,6 +499,11 @@ nsTextTransformer::ScanNormalUnicodeText_F(PRBool aForLineBreak,
firstChar = ' ';
*aWasTransformed = PR_TRUE;
}
nsresult rv = mTransformBuf.GrowTo(mBufferPos + 1);
if (NS_FAILED(rv)) {
*aWordLen = 0;
return offset - 1;
}
mTransformBuf.mBuffer[mBufferPos++] = firstChar;
}

Просмотреть файл

@ -438,6 +438,12 @@ nsTextTransformer::ScanNormalUnicodeText_F(PRBool aForLineBreak,
firstChar = ' ';
*aWasTransformed = PR_TRUE;
}
nsresult rv = mTransformBuf.GrowTo(mBufferPos + 1);
if (NS_FAILED(rv)) {
*aWordLen = 0;
return offset - 1;
}
mTransformBuf.mBuffer[mBufferPos++] = firstChar;
if (!breakBetween) {
@ -493,6 +499,11 @@ nsTextTransformer::ScanNormalUnicodeText_F(PRBool aForLineBreak,
firstChar = ' ';
*aWasTransformed = PR_TRUE;
}
nsresult rv = mTransformBuf.GrowTo(mBufferPos + 1);
if (NS_FAILED(rv)) {
*aWordLen = 0;
return offset - 1;
}
mTransformBuf.mBuffer[mBufferPos++] = firstChar;
}