Bug 66786, fix UMR in GetLine(). Fix by Daniel Bratell (bratell@lysator.liu.se). r=heikki, sr=vidur.

This commit is contained in:
heikki%netscape.com 2001-03-07 02:03:57 +00:00
Родитель a4551b8ee8
Коммит a8ee517153
2 изменённых файлов: 8 добавлений и 8 удалений

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

@ -254,18 +254,18 @@ void nsExpatTokenizer::GetLine(const char* aSourceBuffer, PRUint32 aLength,
/* Use start to find the first new line before the error position and
end to find the first new line after the error position */
reachedStart = ('\n' == *start || '\r' == *start || startIndex <= 0);
reachedEnd = ('\n' == *end || '\r' == *end || endIndex >= numCharsInBuffer);
reachedStart = (startIndex <= 0 || '\n' == *start || '\r' == *start);
reachedEnd = (endIndex >= numCharsInBuffer || '\n' == *end || '\r' == *end);
while (!reachedStart || !reachedEnd) {
if (!reachedStart) {
start--;
startIndex--;
reachedStart = ('\n' == *start || '\r' == *start || startIndex <= 0);
reachedStart = (startIndex <= 0 || '\n' == *start || '\r' == *start);
}
if (!reachedEnd) {
end++;
endIndex++;
reachedEnd = ('\n' == *end || '\r' == *end || endIndex >= numCharsInBuffer);
reachedEnd = (endIndex >= numCharsInBuffer || '\n' == *end || '\r' == *end);
}
}

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

@ -254,18 +254,18 @@ void nsExpatTokenizer::GetLine(const char* aSourceBuffer, PRUint32 aLength,
/* Use start to find the first new line before the error position and
end to find the first new line after the error position */
reachedStart = ('\n' == *start || '\r' == *start || startIndex <= 0);
reachedEnd = ('\n' == *end || '\r' == *end || endIndex >= numCharsInBuffer);
reachedStart = (startIndex <= 0 || '\n' == *start || '\r' == *start);
reachedEnd = (endIndex >= numCharsInBuffer || '\n' == *end || '\r' == *end);
while (!reachedStart || !reachedEnd) {
if (!reachedStart) {
start--;
startIndex--;
reachedStart = ('\n' == *start || '\r' == *start || startIndex <= 0);
reachedStart = (startIndex <= 0 || '\n' == *start || '\r' == *start);
}
if (!reachedEnd) {
end++;
endIndex++;
reachedEnd = ('\n' == *end || '\r' == *end || endIndex >= numCharsInBuffer);
reachedEnd = (endIndex >= numCharsInBuffer || '\n' == *end || '\r' == *end);
}
}