Fix crash in XUL sort service -- unsigned ints are never less than 0... Bug

220516, r+sr=dbaron
This commit is contained in:
bzbarsky%mit.edu 2003-09-28 06:05:08 +00:00
Родитель df5266d2bc
Коммит 835e3d55f6
1 изменённых файлов: 6 добавлений и 2 удалений

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

@ -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)) {