[sipX-dev] proposed fix for XPB967:Media Server crashes when recieves an INVITE with multipart/mixed content type SDP
By adding the following line in SipMessageTest::testMultipartBody(), ( please see attached patch for details), I was able to reproduce the crash.
sdpBody->findMediaType("audio", 0);
Here is the cause:
- In SipMessage::getSdpBody, it forcely casts the pointer to object of MimeBodyPart to SdpBody*. It is wrong, as an object of MimeBodyPart is NOT an object of SdpBody. It caused an invalid memory access and resulted in the crash.
- Also, MimeBodyPart is a subclass of HttpBody. Because HttpBody has user-defined constructor, according to C++ rule, MimeBodyPart MUST invoke HttpBody constructor during base initialization.
Verified the fix, and the modified test case SipMessageTest::testMultipartBody passed without crash.
Patch is attached. Any comment is welcome.
cheers
Huijun
The best gets better. See why everyone is raving about the
All-new Yahoo! Mail.