Bug 680396 - TB 6.0 crash when sending or saving an e-mail with attached PDF. r=dbienvenu, a=standard8
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Wed, 24 Aug 2011 12:46:03 +0900
changeset 8780 49d31af85184e0bf9fda2dd8a943862f5912cb60
parent 8779 7ad5d6eb752754785bd410fb3ad3710d2281be69
child 8781 ad1933bba1c977f59cbdb5b17c5cd3ce8c26bd2e
push id158
push userbugzilla@standard8.plus.com
push dateTue, 27 Sep 2011 19:18:14 +0000
treeherdercomm-beta@e47b99c61e4d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbienvenu, standard8
bugs680396
Bug 680396 - TB 6.0 crash when sending or saving an e-mail with attached PDF. r=dbienvenu, a=standard8
mailnews/compose/src/nsMsgAttachmentHandler.cpp
--- a/mailnews/compose/src/nsMsgAttachmentHandler.cpp
+++ b/mailnews/compose/src/nsMsgAttachmentHandler.cpp
@@ -578,17 +578,19 @@ nsMsgAttachmentHandler::PickCharset()
     tmpFile->GetNativeLeafName(leafName);
     rv = NS_NewLocalFileInputStream(getter_AddRefs(inputFile), tmpFile);
     NS_ENSURE_SUCCESS(rv, rv);
 
     lineInputStream = do_QueryInterface(inputFile, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     detector->Init(obs);
-    while (isMore && NS_SUCCEEDED(lineInputStream->ReadLine(buffer, &isMore)))
+    while (isMore &&
+           NS_SUCCEEDED(lineInputStream->ReadLine(buffer, &isMore)) &&
+           buffer.Length() > 0)
     {
       detector->DoIt(buffer.get(), buffer.Length(), &dontFeed);
       if (dontFeed)
         break;
     }
     detector->Done();
   }
   return NS_OK;