[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepimlibs (merge)
From:       Thomas McGuire <mcguire () kde ! org>
Date:       2010-07-09 12:20:55
Message-ID: 20100709122055.3D5C7AC85D () svn ! kde ! org
[Download RAW message or body]

SVN commit 1147936 by tmcguire:

SVN_MERGE:
Merged revisions 1147832 via svnmerge from 
svn+ssh://tmcguire@svn.kde.org/home/kde/branches/KDE/4.5/kdepimlibs

........
  r1147832 | tmcguire | 2010-07-09 10:55:37 +0200 (Fri, 09 Jul 2010) | 1 line
  
  Don't crash when encountering mails with a header without type.
........


 _M            . (directory)  
 M  +3 -0      kmime/kmime_header_parsing.cpp  
 M  +6 -0      kmime/tests/auto/messagetest.cpp  
 M  +1 -0      kmime/tests/auto/messagetest.h  
 A             kmime/tests/data/mails/dfaure-crash.mbox   \
branches/KDE/4.5/kdepimlibs/kmime/tests/data/mails/dfaure-crash.mbox#1147832


--- trunk/KDE/kdepimlibs/kmime/kmime_header_parsing.cpp #1147935:1147936
@@ -2115,7 +2115,10 @@
     if ( folded ) {
       rawFieldBody = unfoldHeader( rawFieldBody );
     }
+    // We might get an invalid mail without a field name, don't crash on that.
+    if ( !rawType.isEmpty() ) {
     header = HeaderFactory::self()->createHeader( rawType );
+    }
     if( !header ) {
       //kWarning() << "Returning Generic header of type" << rawType;
       header = new Headers::Generic( rawType );
--- trunk/KDE/kdepimlibs/kmime/tests/auto/messagetest.cpp #1147935:1147936
@@ -142,6 +142,12 @@
   delete msg;
 }
 
+void MessageTest::testDavidsParseCrash()
+{
+  KMime::Message::Ptr mail = readAndParseMail( QLatin1String( "dfaure-crash.mbox" ) \
); +  QCOMPARE( mail->to()->asUnicodeString().toAscii().data(), "frank@domain.com" );
+}
+
 void MessageTest::testHeaderFieldWithoutSpace()
 {
   // Headers without a space, like the CC header here, are allowed according to
--- trunk/KDE/kdepimlibs/kmime/tests/auto/messagetest.h #1147935:1147936
@@ -31,6 +31,7 @@
     void testMainBodyPart();
     void testBrunosMultiAssembleBug();
     void testWillsAndTillsCrash();
+    void testDavidsParseCrash();
     void testHeaderFieldWithoutSpace();
     void testWronglyFoldedHeaders();
     void missingHeadersTest();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic