Third batch of fixes related to Christoph Bartoschek's email in kde-pim:

- kmail/imapaccountbase.cpp:1102
If line 1092 gets executed and also 1102, then the second crashes.

- kmail/kmmsgdict.cpp:248
If folder is NULL as indicated by line 244, then line 248 crashes.

- kmail/kmmsgdict.cpp:214
If folder is NULL as indicated by line 208, then line 214,225, crashes.

- kmail/renamejob.cpp:64 
If storage is NULL as indicated by line 57, then line 62 crashes.

Lines where the operator preference between & and == leads to an error.
- kmail/kmmsgbase.cpp:873

- kmail/kmfolderimap.cpp:876
If f is NULL as indicated by line 869, then line 876 crashes.

- kmail/kmsender.cpp:362
If sentFolder is NULL as indicated by line 340, then line 362, 367
crashes.

Thanks to Christoph for working on this.


svn path=/branches/KDE/3.5/kdepim/; revision=530119
wilder-work
Ismail Onur Filiz 20 years ago
parent 9c2800feea
commit 29d2238ad2
  1. 4
      imapaccountbase.cpp
  2. 6
      kmfolderimap.cpp
  3. 2
      kmmsgbase.cpp
  4. 22
      kmmsgdict.cpp
  5. 6
      kmsender.cpp
  6. 12
      renamejob.cpp

@ -1098,10 +1098,10 @@ namespace KMail {
{
DwBodyPart* newparent = dwpart;
const DwMessage* newmsg = dwmsg;
if ( part->originalContentTypeStr() == "MESSAGE/RFC822" &&
if ( part->originalContentTypeStr() == "MESSAGE/RFC822" && dwpart &&
dwpart->Body().Message() )
{
// set the encapsulated message as new parent message
// set the encapsulated message as the new message
newparent = 0;
newmsg = dwpart->Body().Message();
}

@ -878,8 +878,10 @@ void KMFolderImap::initInbox()
}
kmkernel->imapFolderMgr()->contentsChanged();
}
f->initializeFrom( this, "/INBOX/", "message/directory" );
f->setChildrenState( QString::null );
if ( f ) {
f->initializeFrom( this, "/INBOX/", "message/directory" );
f->setChildrenState( QString::null );
}
// so we have an INBOX
mAccount->setHasInbox( true );
}

@ -870,7 +870,7 @@ QCString KMMsgBase::encodeRFC2231String( const QString& _str,
char *l;
for ( l = latin.data(); *l; ++l ) {
if ( ( *l & 0xE0 == 0 ) || ( *l & 0x80 ) )
if ( ( ( *l & 0xE0 ) == 0 ) || ( *l & 0x80 ) )
// *l is control character or 8-bit char
break;
}

@ -205,7 +205,16 @@ unsigned long KMMsgDict::insert(unsigned long msgSerNum,
}
KMFolderIndex* folder = static_cast<KMFolderIndex*>( msg->storage() );
if (folder && index == -1)
if ( !folder ) {
kdDebug(5006) << "KMMsgDict::insert: Cannot insert the message, "
<< "null pointer to storage. Requested serial: " << msgSerNum
<< endl;
kdDebug(5006) << " Message info: Subject: " << msg->subject() << ", To: "
<< msg->toStrip() << ", Date: " << msg->dateStr() << endl;
return 0;
}
if (index == -1)
index = folder->find(msg);
// Should not happen, indicates id file corruption
@ -241,7 +250,16 @@ void KMMsgDict::replace(unsigned long msgSerNum,
const KMMsgBase *msg, int index)
{
KMFolderIndex* folder = static_cast<KMFolderIndex*>( msg->storage() );
if ( folder && index == -1 )
if ( !folder ) {
kdDebug(5006) << "KMMsgDict::replace: Cannot replace the message serial "
<< "number, null pointer to storage. Requested serial: " << msgSerNum
<< endl;
kdDebug(5006) << " Message info: Subject: " << msg->subject() << ", To: "
<< msg->toStrip() << ", Date: " << msg->dateStr() << endl;
return;
}
if ( index == -1 )
index = folder->find( msg );
remove( msgSerNum );

@ -373,8 +373,10 @@ void KMSender::doSendMsg()
KMessageBox::information(0, i18n("Critical error: "
"Unable to process sent mail (out of space?)"
"Moving failing message to \"sent-mail\" folder."));
sentFolder->moveMsg(mCurrentMsg);
sentFolder->close();
if ( sentFolder ) {
sentFolder->moveMsg(mCurrentMsg);
sentFolder->close();
}
cleanup();
return;
case 1:

@ -59,11 +59,13 @@ RenameJob::RenameJob( FolderStorage* storage, const QString& newName,
mNewName( newName ), mNewFolder( 0 )
{
mStorageTempOpened = 0;
mOldName = storage->name();
if ( storage->folderType() == KMFolderTypeImap ) {
mOldImapPath = static_cast<KMFolderImap*>(storage)->imapPath();
} else if ( storage->folderType() == KMFolderTypeCachedImap ) {
mOldImapPath = static_cast<KMFolderCachedImap*>(storage)->imapPath();
if ( storage ) {
mOldName = storage->name();
if ( storage->folderType() == KMFolderTypeImap ) {
mOldImapPath = static_cast<KMFolderImap*>(storage)->imapPath();
} else if ( storage->folderType() == KMFolderTypeCachedImap ) {
mOldImapPath = static_cast<KMFolderCachedImap*>(storage)->imapPath();
}
}
}

Loading…
Cancel
Save