Closed Bug 413548 Opened 17 years ago Closed 12 years ago

null-arg checks in nsMsgThreadedDBView.cpp, nsMsgSendLater.cpp, nsSmtpUrl.cpp, nsImapIncomingServer.cpp, nsPop3IncomingServer.cpp

Categories

(MailNews Core :: Backend, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 13.0

People

(Reporter: jminta, Assigned: aceman)

References

(Blocks 1 open bug)

Details

(Keywords: crash)

Attachments

(1 file, 2 obsolete files)

Attached patch patch v1 (obsolete) — Splinter Review
These should all be fairly simple.  A couple of crashes on strlen() and one attempted null-check that didn't actually do its job.
Attachment #298534 - Flags: superreview?(dmose)
Attachment #298534 - Flags: review?(bugzilla)
Comment on attachment 298534 [details] [diff] [review]
patch v1

+  NS_ENSURE_ARG_POINTER(newHdr);
   nsresult rv = NS_OK;

nit: these need blank lines after them.

-  NS_ENSURE_ARG_POINTER(aSenderIdentity); 
+  NS_ENSURE_ARG_POINTER(*aSenderIdentity); 

What happens if aSenderIdentity is nsnull... ? We need to have both checks here.
Attachment #298534 - Flags: review?(bugzilla) → review-
Attachment #298534 - Flags: superreview?(dmose)
Product: Core → MailNews Core
better error checking wanted TB3?
I picked this and  Bug 413590 for wanted-thunderbird? as it seems these two would have the most impact
Flags: wanted-thunderbird3?
Flags: wanted-thunderbird3? → wanted-thunderbird3+
Comment on attachment 298534 [details] [diff] [review]
patch v1

Patch has obsoleted (along with r-):

$ patch -p1 --dry-run < ~/Desktop/p413548.diff 
patching file mailnews/base/src/nsMsgThreadedDBView.cpp
Hunk #1 succeeded at 404 with fuzz 2 (offset -170 lines).
patching file mailnews/compose/src/nsMsgSendLater.cpp
Hunk #1 succeeded at 350 (offset 104 lines).
Hunk #2 FAILED at 1218.
1 out of 2 hunks FAILED -- saving rejects to file mailnews/compose/src/nsMsgSendLater.cpp.rej
patching file mailnews/compose/src/nsSmtpUrl.cpp
Hunk #1 succeeded at 754 with fuzz 1 (offset 143 lines).
patching file mailnews/imap/src/nsImapIncomingServer.cpp
Hunk #1 succeeded at 688 (offset 6 lines).
Hunk #2 succeeded at 2264 (offset -298 lines).
Hunk #3 FAILED at 2435.
1 out of 3 hunks FAILED -- saving rejects to file mailnews/imap/src/nsImapIncomingServer.cpp.rej
patching file mailnews/local/src/nsPop3IncomingServer.cpp
Hunk #1 succeeded at 655 (offset 108 lines).
patching file mailnews/mime/src/nsMimeConverter.cpp
Hunk #1 succeeded at 111 (offset -25 lines).
Attachment #298534 - Attachment is obsolete: true
Whiteboard: [has draft patch][patchlove]
serge, are you up for taking this and finishing it off?
(In reply to comment #4)

I should be able to help: see bug 412109 comment 3...
Serge, will you take it? Or can I?
Assignee: jminta → acelists
(In reply to Mark Banner (:standard8) from comment #1)
> -  NS_ENSURE_ARG_POINTER(aSenderIdentity); 
> +  NS_ENSURE_ARG_POINTER(*aSenderIdentity); 
> 
> What happens if aSenderIdentity is nsnull... ? We need to have both checks
> here.

This breaks tests, so I'll remove it.
Attached patch patch v2 (obsolete) — Splinter Review
Rearchitected the patch, added some other enhancements. Tests seem to pass.
The big change in
nsMsgThreadedDBView::OnNewHeader(nsIMsgDBHdr *newHdr, nsMsgKey aParentKey, bool ensureListed)
is just conversion of the function to early returns and thus removing 2 nested else blocks (and indents). It should not change the logic but please check.
Attachment #587830 - Flags: review?(mbanner)
Spun off nsMimeConverter.cpp changes to bug 717407. There is some more work and this patch is already too large.
Summary: null-arg checks in nsMsgThreadedDBView.cpp, nsMsgSendLater.cpp, nsSmtpUrl.cpp, nsImapIncomingServer.cpp, nsPop3IncomingServer.cpp, nsMimeConverter.cpp → null-arg checks in nsMsgThreadedDBView.cpp, nsMsgSendLater.cpp, nsSmtpUrl.cpp, nsImapIncomingServer.cpp, nsPop3IncomingServer.cpp
Comment on attachment 587830 [details] [diff] [review]
patch v2

Review of attachment 587830 [details] [diff] [review]:
-----------------------------------------------------------------

This is basically r+, but I'd like you to update the patch before I test it.

::: mailnews/base/src/nsMsgThreadedDBView.cpp
@@ +600,5 @@
>    // This is the mail behaviour, but threaded views want
>    // to insert in order...
> +  PRUint32 msgFlags;
> +  newHdr->GetFlags(&msgFlags);
> +  if ((m_viewFlags & nsMsgViewFlagsType::kUnreadOnly) && !ensureListed && (msgFlags & nsMsgMessageFlags::Read))

nit: lets wrap this a bit:

if ((m_viewFlags & nsMsgViewFlagsType::kUnreadOnly) && !ensureListed &&
    (msgFlags & nsMsgMessageFlags::Read))

@@ +644,3 @@
>  
> +    if (!(flags & nsMsgMessageFlags::Elided)) // thread is expanded
> +    {  // insert child into thread

nit: start comment on next line please, and with a capital as its a sentence.

@@ +696,4 @@
>    }
> +  else // adding msg to thread that's not in view.
> +  {
> +    if (threadHdr)

This can just be combined with the else to make one else if ...
Attachment #587830 - Flags: review?(mbanner) → feedback+
Attached patch patch v3Splinter Review
Attachment #587830 - Attachment is obsolete: true
Attachment #598972 - Flags: review?(mbanner)
Whiteboard: [has draft patch][patchlove]
Attachment #598972 - Flags: review?(mbanner) → review+
Keywords: checkin-needed
Checked in: http://hg.mozilla.org/comm-central/rev/4487f9fbfe2d
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 13.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: