bounds-check bookmark notifications. bug 322379 r=brettw

Original committer: bryner%brianryner.com
Original revision: 1.30
Original date: 2006/01/06 01:38:44
This commit is contained in:
benjamin%smedbergs.us 2006-07-18 18:18:54 +00:00
parent fcae0cb4d1
commit caf50ab833

View File

@ -644,6 +644,10 @@ nsNavHistoryQueryNode::OnItemRemoved(nsIURI *aBookmark,
PRInt64 aFolder, PRInt32 aIndex) PRInt64 aFolder, PRInt32 aIndex)
{ {
if (FolderId() == aFolder) { if (FolderId() == aFolder) {
if (aIndex < 0 || aIndex >= mChildren.Count()) {
return NS_ERROR_INVALID_ARG;
}
// If we're not expanded, we can just invalidate our child list // If we're not expanded, we can just invalidate our child list
// and rebuild it the next time we're opened. // and rebuild it the next time we're opened.
if (!mExpanded) { if (!mExpanded) {
@ -817,6 +821,10 @@ nsNavHistoryQueryNode::OnFolderRemoved(PRInt64 aFolder,
PRInt64 aParent, PRInt32 aIndex) PRInt64 aParent, PRInt32 aIndex)
{ {
if (FolderId() == aParent) { if (FolderId() == aParent) {
if (aIndex < 0 || aIndex >= mChildren.Count()) {
return NS_ERROR_INVALID_ARG;
}
// If we're not expanded, we can just invalidate our child list // If we're not expanded, we can just invalidate our child list
// and rebuild it the next time we're opened. // and rebuild it the next time we're opened.
if (!mExpanded) { if (!mExpanded) {