[Kde-pim] Review Request: Bug 86302: Handle malformed multi-line mail headers

Thomas McGuire mcguire at kde.org
Sat Jan 16 12:46:11 GMT 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/2561/#review3721
-----------------------------------------------------------


Oldrich, thank you for providing this patch, I'm especially happy that you created a version for KMime.

The patch still needs some corrections, then it can be committed. See below for the current problems the patch has:

With the current trunk, these modifications produce a test failure in kmime-kmime_message_test:

QFATAL : MessageTest::testHeaderFieldWithoutSpace() ASSERT: "i >= 0 && i < size()" in file include/QtCore/../../src/corelib/tools/qbytearray.h, line 395
FAIL!  : MessageTest::testHeaderFieldWithoutSpace() Received a fatal error.

Backtrace:

#5  0x00007ffff64bd377 in qt_assert (assertion=0x7ffff7bc0476 "i >= 0 && i < size()",
    file=0x7ffff7bc0410 "kde-qt/include/QtCore/../../src/corelib/tools/qbytearray.h", line=395) at global/qglobal.cpp:1975
#6  0x00007ffff7b8fc89 in QByteArray::at (this=0x7fffffffbe50, i=9) at kde-qt/include/QtCore/../../src/corelib/tools/qbytearray.h:395
#7  0x00007ffff7b8d90d in KMime::findHeaderLineEnd (src="X-Mailer:" = {...}, dataBegin=@0x7fffffffbde8, folded=0x7fffffffbdef)
    at kdepimlibs/kmime/kmime_util.cpp:426
#8  0x00007ffff7b9927e in KMime::HeaderParsing::extractFirstHeader (head="X-Mailer:" = {...}) at kdepimlibs/kmime/kmime_header_parsing.cpp:2064
#9  0x00007ffff7b993ae in KMime::HeaderParsing::parseHeaders (head="From:\nTo: heinz at test.de\nCc:moritz at test.de\nSubject: Test\nX-Mailer:" = {...})
    at kdepimlibs/kmime/kmime_header_parsing.cpp:2092
#10 0x00007ffff7ba5682 in KMime::Content::parse (this=0x7fffffffbf80) at kdepimlibs/kmime/kmime_content.cpp:180
#11 0x00007ffff7bbd389 in KMime::Message::parse (this=0x7fffffffbf80) at kdepimlibs/kmime/kmime_message.cpp:49
#12 0x0000000000405192 in MessageTest::testHeaderFieldWithoutSpace (this=0x7fffffffd540) at kdepimlibs/kmime/tests/kmime_message_test.cpp:157

Seems that the new function findHeaderLineEnd() doesn't like headers with an empty field, like "XMailer:" in this test, when they are at the end of a mail.

For what version of kdepimlibs did you write this patch? The test testHeaderFieldWithoutSpace() is relatively new.

Can you please correct the patch so that this test passes as well? If you don't have the right version for this, please tell me, and I'll see if I can fix this myself.

Also, please fix the compiler warnings that the patch produces, I have listed them below as inline comments.



/branches/work/akonadi-ports/kdepimlibs/kmime/kmime_header_parsing.cpp
<http://reviewboard.kde.org/r/2561/#comment3085>

    This variable is now unused, please remove it.



/branches/work/akonadi-ports/kdepimlibs/kmime/kmime_util.cpp
<http://reviewboard.kde.org/r/2561/#comment3083>

    This produces a warning:
    kmime_util.cpp:393: warning: suggest parentheses around && within || 



/branches/work/akonadi-ports/kdepimlibs/kmime/kmime_util.cpp
<http://reviewboard.kde.org/r/2561/#comment3084>

    Same warning here


- Thomas


On 2010-01-14 17:04:00, Oldrich Jedlicka wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/2561/
> -----------------------------------------------------------
> 
> (Updated 2010-01-14 17:04:00)
> 
> 
> Review request for KDE PIM.
> 
> 
> Summary
> -------
> 
> Parse correctly malformed multi-line mail headers. When the next header line starts with =09/=20, it is apparently an encoded tab/space character that marks header continuation.
> 
> Fixes bug 86302.
> 
> 
> This addresses bug 86302.
>     https://bugs.kde.org/show_bug.cgi?id=86302
> 
> 
> Diffs
> -----
> 
>   /branches/work/akonadi-ports/kdepimlibs/kmime/kmime_header_parsing.cpp 1073141 
>   /branches/work/akonadi-ports/kdepimlibs/kmime/kmime_util.cpp 1073141 
>   /branches/work/akonadi-ports/kdepimlibs/kmime/kmime_util_p.h 1073141 
>   /branches/work/akonadi-ports/kdepimlibs/kmime/tests/kmime_util_test.cpp 1073141 
> 
> Diff: http://reviewboard.kde.org/r/2561/diff
> 
> 
> Testing
> -------
> 
> Updated tests in kmime/tests.
> 
> 
> Thanks,
> 
> Oldrich
> 
>

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list