MRG qpid-cpp-client sync() and close() Crash if Session is Not Assigned

Solution Verified - Updated -

Environment

  • MRG Messaging 1.3
  • qpid-cpp-client-0.7.946106-12

Issue

C++ Session::sync()/close() both crash if Session is not assigned using Connection::createSession()

Resolution

The Session class extends Handle, which is like a pointer.  Using a null handle, like using a null pointer, is invalid. There are methods to test whether a handle is valid or null. For example:

Session session;
....
if (session) {
   //session is safe to use
} else {
   //session is null
}

There are also more explicit methods (isValid()/isNull()).

Diagnostic Steps

Create a Session using the default constructor, then call either  'sync()' or 'close()' on the session. Either of these calls will result  in a segmentation fault.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments