zeromq / libzmq

ZeroMQ core engine in C++, implements ZMTP/3.1
https://www.zeromq.org
Mozilla Public License 2.0
9.71k stars 2.35k forks source link

ACCESS_VIOLATION errors due to nullptr writes in wepoll.c #4496

Open ratzrattillo opened 1 year ago

ratzrattillo commented 1 year ago

I experienced ACCESS_VIOLATION errors when using libzmq in a rust project, originating from wepoll.c.

Affected lines: https://github.com/zeromq/libzmq/blob/master/external/wepoll/wepoll.c#L1223 https://github.com/zeromq/libzmq/blob/master/external/wepoll/wepoll.c#L1842

I opened an issue in the wepoll project at: https://github.com/piscisaureus/wepoll/issues/32

notgull commented 1 year ago

This issue probably comes from using the distribution wepoll with the patched version that the polling crate uses. polling patches wepoll so that a null completion packet can be used to wake up an ongoing poll operation, which is necessary for futures to be able to run themselves. If the distribution wepoll is overriding the patched wepoll, this means that a null packet sent by polling will cause a segmentation fault.

See smol-rs/polling#85 and Aclysma/wepoll-ffi#1. I doubt this is an issue with libzmq at this stage.