Details
Description
There is an USER 23 crash during QMessage::appendAttachments(). Crash happens when adding as attachment compressed exe file.
To reproduce and analyse code please refer to CreateMessage test application in attachment.
Before executing test configure one mailbox. Test account: hardstuff12@gmail.com, password: 123xbest.
Panic USER 23 is raised when any operation that moves or copies data to an 8 bit variant descriptor, causes the length of that descriptor to exceed its maximum length.
Problem originates form QMessageContentContainerPrivate::createAttachment() in qmessagecontentcontainer_symbian.cpp:
- TBuf8<20> fileType variable's maximum length is too short. It should be crearted dymanicaly with length of fileDataType.iDataType.Des8().
In tested case, compresed exe file is recognized as "application/x-zip-compressed", length of this string is 28 chars.
TBuf8<20> fileType; TPtrC8 ptr8((TUint8 *)(_content.constData()), _content.length()); if(session.Connect() == KErrNone){ TDataRecognitionResult fileDataType; session.RecognizeData(filePtr, ptr8, fileDataType); fileType.Copy(fileDataType.iDataType.Des8()); mimeType = QByteArray((const char*)fileType.Ptr(), fileType.Length()); session.Close(); }
- declered variables are not used
QString type; TBuf8<255> fileBuffer;