Work around crashes at ChildIterator::get using bounds check on ChildIterator::seek. sr=waterson r=kin a=asa b=133219

git-svn-id: svn://10.0.0.236/trunk@125295 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dbaron%fas.harvard.edu 2002-07-16 14:53:43 +00:00
parent 7ef44d6e76
commit f9da4499fa
2 changed files with 14 additions and 6 deletions

View File

@ -125,8 +125,9 @@ public:
}
void seek(PRUint32 aIndex) {
#ifdef DEBUG
// Make sure that aIndex is reasonable
// Make sure that aIndex is reasonable. This should be |#ifdef
// DEBUG|, but we need these numbers for the temporary workaround
// for bug 133219.
PRUint32 length;
if (mNodes)
mNodes->GetLength(&length);
@ -134,7 +135,10 @@ public:
mContent->ChildCount(NS_REINTERPRET_CAST(PRInt32&, length));
NS_ASSERTION(PRInt32(aIndex) >= 0 && aIndex <= length, "out of bounds");
#endif
// Temporary workaround for bug 133219.
if (aIndex > length)
aIndex = length;
mIndex = aIndex;
}

View File

@ -125,8 +125,9 @@ public:
}
void seek(PRUint32 aIndex) {
#ifdef DEBUG
// Make sure that aIndex is reasonable
// Make sure that aIndex is reasonable. This should be |#ifdef
// DEBUG|, but we need these numbers for the temporary workaround
// for bug 133219.
PRUint32 length;
if (mNodes)
mNodes->GetLength(&length);
@ -134,7 +135,10 @@ public:
mContent->ChildCount(NS_REINTERPRET_CAST(PRInt32&, length));
NS_ASSERTION(PRInt32(aIndex) >= 0 && aIndex <= length, "out of bounds");
#endif
// Temporary workaround for bug 133219.
if (aIndex > length)
aIndex = length;
mIndex = aIndex;
}