poll-based zmq_poll crash with too long timeout

Description

In the poll() based zmq_poll, the long timeout_ parameter is converted to an int timeout. If timeout_ is more than INT_MAX, the int timeout wraps and goes negative, causing poll() to return -1 and errno EINVAL.

Not a problem in "normal" use cases, but if timeout is set very high by accident (or by intention, after all the interface does allow for a long to be passed), we should at least not crash.
Not sure how this is best fixed, the polling code seems to do some looping with multiple passes, so I guess proper functionality could be implemented by making sure this loop goes on for as long as there is time left.

Environment

Mac OS 10.6.8

Tested on 2.1.10, but looks like code is identical in 2.1.11.

Activity

Show:

Details

Assignee

Reporter

Components

Affects versions

Priority

Created February 8, 2012 at 12:24 PM
Updated February 8, 2012 at 12:24 PM