On 11/06/2009 07:30 PM, Carl Trieloff wrote:
+    if(!messages.empty()){
+        QueuedMessage compM;
+        compM.position = pos;
+        unsigned long diff = pos.getValue() - 
messages.front().position.getValue();
+        long maxEnd = diff<  messages.size()? diff : messages.size();
+
+        Messages::iterator i = 
lower_bound(messages.begin(),messages.begin()+maxEnd,compM);
+        if (i->position == pos)
+            return i;

That looks unsafe to me; if lower_bound() returns messages.end(), i->position will not be valid.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to