summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-10 21:55:53 -0500
committerMatt A. Tobin <email@mattatobin.com>2019-11-10 21:55:53 -0500
commit05667b0d48b50f434ea48a3065adea6c0a88f226 (patch)
tree5fced8d4c405f397d772458410179d4bdacd91bb
parentfdcb16661603d4aff52480ba1d68f37562d1dc4d (diff)
downloadUXP-05667b0d48b50f434ea48a3065adea6c0a88f226.tar
UXP-05667b0d48b50f434ea48a3065adea6c0a88f226.tar.gz
UXP-05667b0d48b50f434ea48a3065adea6c0a88f226.tar.lz
UXP-05667b0d48b50f434ea48a3065adea6c0a88f226.tar.xz
UXP-05667b0d48b50f434ea48a3065adea6c0a88f226.zip
Bug 1494764 - Removed MOZ_ASSERT but now still process line where it would occur.
MOZ_ASSERT changed to NS_WARNING. Also correctly handle case where last chunk ends with \r. Tested to make sure that regression identified in Bug 1494764 comment 10 remains fixed and that non-chunked and chunked messages are handled correctly including when \r\n is split between chunks. Tag #1273
-rw-r--r--mailnews/imap/src/nsImapServerResponseParser.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/mailnews/imap/src/nsImapServerResponseParser.cpp b/mailnews/imap/src/nsImapServerResponseParser.cpp
index fb51db217..d37231ab9 100644
--- a/mailnews/imap/src/nsImapServerResponseParser.cpp
+++ b/mailnews/imap/src/nsImapServerResponseParser.cpp
@@ -3143,11 +3143,13 @@ bool nsImapServerResponseParser::msg_fetch_literal(bool chunk, int32_t origin)
if (fTotalDownloadSize > 0)
fServerConnection.PercentProgressUpdateEvent(0, charsReadSoFar + origin, fTotalDownloadSize);
}
- if (charsReadSoFar > numberOfCharsInThisChunk)
+ if (!lastChunk && (charsReadSoFar > numberOfCharsInThisChunk))
{
- // This is the last line of a chunk. "Literal" here means actual email data and
- // its EOLs, without imap protocol elements and their EOLs. End of line is
- // defined by two characters \r\n (i.e., CRLF, 0xd,0xa) specified by RFC822.
+ // This is the last line of a chunk but not the last chunk of a multi-chunk
+ // message or the only "chunk" of a smaller non-chunked message. "Literal" here
+ // means actual email data and its EOLs, without imap protocol elements and their
+ // EOLs. End of line is defined by two characters \r\n (i.e., CRLF, 0xd,0xa)
+ // specified by RFC822.
// Here is an example the most typical last good line of a chunk:
// "1s8AA5i4AAvF4QAG6+sAAD0bAPsAAAAA1OAAC)\r\n", where ")\r\n" are non-literals.
// This an example of the last "good" line of a chunk that terminates with \r\n
@@ -3217,7 +3219,7 @@ bool nsImapServerResponseParser::msg_fetch_literal(bool chunk, int32_t origin)
}
else
{
- // Not the last line of a chunk.
+ // Not the last line of a chunk or any line when lastChunk.
if (!fNextChunkStartsWithNewline)
{
// Process unmodified fCurrentLine string.
@@ -3229,7 +3231,7 @@ bool nsImapServerResponseParser::msg_fetch_literal(bool chunk, int32_t origin)
{
// Ignore the orphan '\n' on a line by itself.
MOZ_ASSERT(strlen(fCurrentLine) == 1 && fCurrentLine[0] == '\n',
- "Expect '\n' as only character in this line");
+ "Expect '\\n' as only character in this line");
fNextChunkStartsWithNewline = false;
}
}