qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Sim <g...@redhat.com>
Subject Re: Remove liner queue functions
Date Mon, 09 Nov 2009 14:46:32 GMT
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:dev-subscribe@qpid.apache.org


Mime
View raw message