Fix crash in XUL sort service -- unsigned ints are never less than 0... Bug
220516, r+sr=dbaron git-svn-id: svn://10.0.0.236/trunk@147390 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1103,7 +1103,9 @@ XULSortServiceImpl::SortContainer(nsIContent *container, sortPtr sortInfo,
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
currentElement = numChildren;
|
||||
PRUint32 childIndex;
|
||||
for (childIndex = numChildren - 1; childIndex >= 0; --childIndex) {
|
||||
// childIndex is unsigned, so childIndex >= 0 would always test true
|
||||
for (childIndex = numChildren; childIndex > 0; ) {
|
||||
--childIndex;
|
||||
nsIContent *child = container->GetChildAt(childIndex);
|
||||
|
||||
if (child->IsContentOfType(nsIContent::eXUL)) {
|
||||
@@ -1162,8 +1164,10 @@ XULSortServiceImpl::SortContainer(nsIContent *container, sortPtr sortInfo,
|
||||
sizeof(contentSortInfo*), testSortCallback, (void*)sortInfo);
|
||||
}
|
||||
|
||||
for (childIndex = numChildren - 1; childIndex >= 0; childIndex--)
|
||||
// childIndex is unsigned, so childIndex >= 0 would always test true
|
||||
for (childIndex = numChildren; childIndex > 0; )
|
||||
{
|
||||
--childIndex;
|
||||
nsIContent *child = container->GetChildAt(childIndex);
|
||||
|
||||
if (child->IsContentOfType(nsIContent::eXUL)) {
|
||||
|
||||
Reference in New Issue
Block a user