Uploaded image for project: 'ActiveMQ C++ Client'
  1. ActiveMQ C++ Client
  2. AMQCPP-71

Missing NULL pointer check in MessageConsumer::autoAcknowledge

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • Other C++ Clients
    • None
    • RHEL ES 4/32bit

    Description

      When you call consumer->receive() on empty queue receive method returns NULL message but before return MessageConsumer::autoAcknowledge method is invoked. This method doesn't check message against NULL, this cause coredump is message is NULL.

      Patch:
      p<IMessage> MessageConsumer::autoAcknowledge(p<IMessage> message)
      {
      try
      {
      if ( message != NULL )

      { // <------ Check NULL here !!!!! // Is the message an ActiveMQMessage? (throws bad_cast otherwise) p<ActiveMQMessage> activeMessage = p_dyncast<ActiveMQMessage> (message) ; // Register the handler for client acknowledgment activeMessage->setAcknowledger( smartify(this) ) ; if( acknowledgementMode != ClientAckMode ) doAcknowledge(activeMessage) ; }

      }
      catch( bad_cast& bc )

      { // ignore }

      return message ;

      Attachments

        1. patch.txt
          1 kB
          Timothy A. Bish

        Activity

          People

            nmittler Nathan Christopher Mittler
            bigsam72 Radek Sedmak
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 10m
                10m
                Remaining:
                Remaining Estimate - 10m
                10m
                Logged:
                Time Spent - Not Specified
                Not Specified