Add a bounds check in do_BreakGetTextDimensions. May or may not be related to the crashes reported in bug 196484. Author=roland.mainz@informatik.med.uni-giessen.de, r=smontagu, sr=rbs.

This commit is contained in:
smontagu%netscape.com 2003-03-26 03:45:45 +00:00
Родитель 07dc983e89
Коммит 7a8c2c94d5
4 изменённых файлов: 8 добавлений и 4 удалений

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

@ -4166,7 +4166,8 @@ do_BreakGetTextDimensions(const nsFontSwitchGTK *aFontSwitch,
// Find the nearest place to break that is less than or equal to
// the estimated break offset
breakIndex = data->mPrevBreakState_BreakIndex;
while (data->mBreaks[breakIndex + 1] <= estimatedBreakOffset) {
while (breakIndex + 1 < data->mNumBreaks &&
data->mBreaks[breakIndex + 1] <= estimatedBreakOffset) {
++breakIndex;
}

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

@ -1647,7 +1647,8 @@ do_BreakGetTextDimensions(const nsFontSwitch* aFontSwitch,
// Find the nearest place to break that is less than or equal to
// the estimated break offset
breakIndex = data->mPrevBreakState_BreakIndex;
while (data->mBreaks[breakIndex + 1] <= estimatedBreakOffset) {
while (breakIndex + 1 < data->mNumBreaks &&
data->mBreaks[breakIndex + 1] <= estimatedBreakOffset) {
++breakIndex;
}

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

@ -1814,7 +1814,8 @@ do_BreakGetTextDimensions(const nsFontSwitch* aFontSwitch,
// Find the nearest place to break that is less than or equal to
// the estimated break offset
breakIndex = data->mPrevBreakState_BreakIndex;
while (data->mBreaks[breakIndex + 1] <= estimatedBreakOffset) {
while (breakIndex + 1 < data->mNumBreaks &&
data->mBreaks[breakIndex + 1] <= estimatedBreakOffset) {
++breakIndex;
}

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

@ -1679,7 +1679,8 @@ do_BreakGetTextDimensions(const nsFontSwitchXlib *aFontSwitch,
// Find the nearest place to break that is less than or equal to
// the estimated break offset
breakIndex = data->mPrevBreakState_BreakIndex;
while (data->mBreaks[breakIndex + 1] <= estimatedBreakOffset) {
while (breakIndex + 1 < data->mNumBreaks &&
data->mBreaks[breakIndex + 1] <= estimatedBreakOffset) {
++breakIndex;
}