Closed
Bug 248933
Opened 21 years ago
Closed 21 years ago
IMAP parser: end of line is not handled correctly while parsing quoted/literal strings
Categories
(MailNews Core :: Networking: IMAP, defect)
MailNews Core
Networking: IMAP
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: engel, Assigned: engel)
References
Details
Attachments
(1 file, 1 obsolete file)
6.39 KB,
patch
|
Bienvenu
:
review+
dmosedale
:
superreview+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040622
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040622
The logic of the imap parser is to set an 'end-of-line' flag if |fNextToken|
corresponds to the end of the line. However, in the current implementation of
|CreateQuoted| and |CreateLiteral|, the 'end-of-line' flag is set according to
the token *after* |fNextToken| (i.e., this code checks if
|fCurrentTokenPlaceHolder| is at the end of the line). This should be made
consistent.
The correct parser usage is to call |CreateQuoted|/|CreateLiteral|, then
|GetNextToken| and finally to check for the end-of-line condition. This is
currently implemented this way in all the imap parser code, so no change is
required outside |CreateQuoted|/|CreateLiteral|.
Due to this incorrect end-of-line handling, a kludge was used in
nsImapServerResponseParser.cpp, where the |fAtEndOfLine| was reset by hand.
This kludge can be removed while fixing this bug.
Finally, in |CreateLiteral| for some special cases, the behavior beyond the
end-of-line issue is also broken.
In addition, there is a bug in |CreateLiteral| when a 'static buffer' is used
and the current line does not contain the whole literal (a very unlikely case).
For example, if the current line is "{9}\r\n\nxyz\r\n", |CreateLiteral| will
return the string "\nxyz\r\nxyz"; i.e., partially duplicating the input. This
bug can easily be fixed while fixing the bugs described above.
Reproducible: Always
Steps to Reproduce:
Assignee | ||
Comment 1•21 years ago
|
||
These issues outlined above should be fixed with this patch.
Note that we can remove two extra lines, because
|AdvanceTokenizerStartingPoint| recovers all 'token boundaries' and so the
condition |if (!*fCurrentTokenPlaceHolder)| is always false.
Comment 2•21 years ago
|
||
Confirming. While I can't read code, someone should look at the patch...Hans,
feel free to set reviews.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 3•21 years ago
|
||
Hans: Get David Bienvenu to review it.
Assignee | ||
Updated•21 years ago
|
Attachment #151877 -
Flags: review?(bienvenu)
Assignee | ||
Comment 4•21 years ago
|
||
Comment on attachment 151877 [details] [diff] [review]
fixing CreateQuoted and CreateLiteral in IMAPGenericParser, removing kludge in ImapServerResponseParser
This breaks for the very pathological case "{4}\r\nL2\r\nA3\r\n". Note, ther
is no space before A3, thus it probably not a valid imap input. But let us fix
this anyway. New patch forthcoming.
Attachment #151877 -
Attachment is obsolete: true
Attachment #151877 -
Flags: review?(bienvenu)
Assignee | ||
Comment 5•21 years ago
|
||
see comment #1 and comment #4
Added 2x |AdvanceTokenizerStartingPoint(0)| to the patch. This handles more
(hopefully all) special cases correctly.
Assignee | ||
Updated•21 years ago
|
Attachment #151896 -
Flags: review?(bienvenu)
Comment 6•21 years ago
|
||
I'm on vacation - I'll have to try this when I get back. It might take me a week
to get to this - thx for looking into it.
Updated•21 years ago
|
Attachment #151896 -
Flags: review?(bienvenu) → review+
Assignee | ||
Updated•21 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Updated•21 years ago
|
Attachment #151896 -
Flags: superreview?(sspitzer)
Assignee | ||
Updated•21 years ago
|
Assignee: bienvenu → Hans-A.Engel
Status: ASSIGNED → NEW
Assignee | ||
Updated•21 years ago
|
Status: NEW → ASSIGNED
Updated•21 years ago
|
Attachment #151896 -
Flags: superreview?(sspitzer) → superreview?(neil.parkwaycc.co.uk)
Updated•21 years ago
|
Attachment #151896 -
Flags: superreview?(neil.parkwaycc.co.uk) → superreview?(dmose)
Comment 7•21 years ago
|
||
Comment on attachment 151896 [details] [diff] [review]
fixing CreateQuoted and CreateLiteral in IMAPGenericParser, removing kludge in ImapServerResponseParser, v2
sr=dmose
Attachment #151896 -
Flags: superreview?(dmose) → superreview+
Comment 8•21 years ago
|
||
Timeless checked in the 2nd patch, marking FIXED.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Updated•21 years ago
|
Product: MailNews → Core
Updated•16 years ago
|
Product: Core → MailNews Core
You need to log in
before you can comment on or make changes to this bug.
Description
•