bug 732330 - add assertion in ClusterIterator::Next to check for sane/safe result. r=jdaggett

This commit is contained in:
Jonathan Kew 2012-03-04 08:58:54 +00:00
parent 621a59dc0d
commit 0e562c610f
2 changed files with 11 additions and 3 deletions

View File

@ -100,7 +100,10 @@ class ClusterIterator
{
public:
ClusterIterator(const PRUnichar* aText, PRUint32 aLength)
: mText(aText), mLimit(aText + aLength), mPos(aText)
: mPos(aText), mLimit(aText + aLength)
#ifdef DEBUG
, mText(aText)
#endif
{ }
operator const PRUnichar* () const {
@ -114,9 +117,11 @@ public:
void Next();
private:
const PRUnichar* mText;
const PRUnichar* mLimit;
const PRUnichar* mPos;
const PRUnichar* mLimit;
#ifdef DEBUG
const PRUnichar* mText;
#endif
};
} // end namespace unicode

View File

@ -354,6 +354,9 @@ ClusterIterator::Next()
mPos++;
}
}
NS_ASSERTION(mText < mPos && mPos <= mLimit,
"ClusterIterator::Next has overshot the string!");
}
} // end namespace unicode