Bug 676882: Crash in libmime following bug 674488 libmime passes badly encoded char* into JS land as AUTF8Strings landing r=standard8
authorJonathan Protzenko <jonathan.protzenko@gmail.com>
Tue, 09 Aug 2011 09:50:33 -0700
changeset 8277 71b93e1bf96c235a83de95f9df0479aac4974233
parent 8276 b1d3493ea46637b8bbb18c7a1f003580f74a1ffd
child 8278 4cb88997f292f9cb49d10603d741703551d6e5c0
push id6362
push userjonathan.protzenko@gmail.com
push dateTue, 09 Aug 2011 16:51:12 +0000
treeherdercomm-central@71b93e1bf96c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstandard8
bugs676882, 674488
Bug 676882: Crash in libmime following bug 674488 libmime passes badly encoded char* into JS land as AUTF8Strings landing r=standard8
mailnews/mime/src/mimemsg.cpp
--- a/mailnews/mime/src/mimemsg.cpp
+++ b/mailnews/mime/src/mimemsg.cpp
@@ -286,17 +286,17 @@ static int
 MimeMessage_close_headers (MimeObject *obj)
 {
   MimeMessage *msg = (MimeMessage *) obj;
   int status = 0;
   char *ct = 0;      /* Content-Type header */
   MimeObject *body;
 
   // Do a proper decoding of the munged subject.
-  if (obj->headers && msg->hdrs && msg->grabSubject) {
+  if (obj->headers && msg->hdrs && msg->grabSubject && obj->headers->munged_subject) {
     // nsMsgI18NConvertToUnicode wants nsAStrings...
     nsDependentCString orig(obj->headers->munged_subject);
     nsAutoString dest;
     // First, get the Content-Type, then extract the charset="whatever" part of
     // it.
     nsCString charset;
     nsCString contentType;
     contentType.Adopt(MimeHeaders_get(msg->hdrs, HEADER_CONTENT_TYPE, PR_FALSE, PR_FALSE));