Bug 1444389 - Fix crash in nsImapProtocol::HandleMessageDownLoadLine(). r+a=jorgk
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Mon, 01 Oct 2018 15:06:55 +0300
changeset 31852 dec101dffad0dcc8e51dab6f796385f4dc63acac
parent 31851 64a6f36df710713ccbdfa5afecff6283c52fe08b
child 31853 9976c780c36673c9f2bd3f0781b0331e0265dc82
push id86
push usermozilla@jorgk.com
push dateSun, 14 Oct 2018 09:47:49 +0000
treeherdercomm-esr60@e524897f5bde [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1444389
Bug 1444389 - Fix crash in nsImapProtocol::HandleMessageDownLoadLine(). r+a=jorgk
mailnews/imap/src/nsImapProtocol.cpp
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -3840,18 +3840,19 @@ nsImapProtocol::PostLineDownLoadEvent(co
 // * A line may be passed by parts, e.g., "part1 part2\r\n" may be passed as
 //     HandleMessageDownLoadLine("part 1 ", 1);
 //     HandleMessageDownLoadLine("part 2\r\n", 0);
 //   However, it is assumed that a CRLF or a CRCRLF is never split (i.e., this is
 //   ensured *before* invoking this method).
 void nsImapProtocol::HandleMessageDownLoadLine(const char *line, bool isPartialLine,
                                                char *lineCopy)
 {
-  NS_PRECONDITION(lineCopy == nullptr || !PL_strcmp(line, lineCopy),
-                  "line and lineCopy must contain the same string");
+  NS_ENSURE_TRUE_VOID(line);
+  NS_ASSERTION(lineCopy == nullptr || !PL_strcmp(line, lineCopy),
+               "line and lineCopy must contain the same string");
   const char *messageLine = line;
   uint32_t lineLength = strlen(messageLine);
   const char *cEndOfLine = messageLine + lineLength;
   char *localMessageLine = nullptr;
 
   // If we obtain a partial line (due to fetching by chunks), we do not
   // add/modify the end-of-line terminator.
   if (!isPartialLine)