potential fix for crash in nsImapFlagAndUidState::ExpungeByIndex, r=neil, bug 664790
authorDavid Bienvenu <bienvenu@nventure.com>
Mon, 08 Aug 2011 13:12:46 -0700
changeset 8260 93228cb070476333034dc8cd99a591a580053cf0
parent 8259 aef8948fd115ac348064e48510adb8c0351f2d83
child 8261 8b76ed94d36fc1d6d87a9ecfad7ad75ad39ef788
push id6352
push userbienvenu@nventure.com
push dateMon, 08 Aug 2011 20:12:52 +0000
treeherdercomm-central@93228cb07047 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersneil, bug
bugs664790
potential fix for crash in nsImapFlagAndUidState::ExpungeByIndex, r=neil, bug 664790
mailnews/imap/src/nsImapFlagAndUidState.cpp
--- a/mailnews/imap/src/nsImapFlagAndUidState.cpp
+++ b/mailnews/imap/src/nsImapFlagAndUidState.cpp
@@ -165,18 +165,18 @@ NS_IMETHODIMP nsImapFlagAndUidState::Res
   return NS_OK;
 }
 
 
 // Remove (expunge) a message from our array, since now it is gone for good
 
 NS_IMETHODIMP nsImapFlagAndUidState::ExpungeByIndex(PRUint32 msgIndex)
 {
-  // protect ourselves in case the server gave us an index key of -1.....
-  if ((PRInt32) msgIndex < 0)
+  // protect ourselves in case the server gave us an index key of -1 or 0
+  if ((PRInt32) msgIndex <= 0)
     return NS_ERROR_INVALID_ARG;
 
   if ((PRUint32) fUids.Length() < msgIndex)
     return NS_ERROR_INVALID_ARG;
 
   PR_CEnterMonitor(this);
   msgIndex--;  // msgIndex is 1-relative
   if (fFlags[msgIndex] & kImapMsgDeletedFlag) // see if we already had counted this one as deleted