Neopallium / lua-zmq

Lua zeromq2 binding
http://github.com/Neopallium/lua-zmq
MIT License
153 stars 36 forks source link

Assertion on bad socket url #8

Closed agladysh closed 13 years ago

agladysh commented 13 years ago

This is likely to be a ZMQ problem, but it still sucks to get a crash on bad user input, so maybe you can report it upstream?

$ lua -l zmq -e 'print("V:", unpack(zmq.version())) ctx=zmq.init(2) c=assert(ctx:socket(zmq.SUB)) print("E:", c:bind("pgm://127.0.0.1:5555"))'
V:  2   1   4
E:  true    nil
Warn: Interface lo reports as a loopback device.
Warn: Interface lo reports as a non-multicast capable device.
Error: PGM protocol requires CAP_NET_RAW capability, e.g. sudo execcap 'cap_net_raw=ep'
Warn: Close on IP Router Alert (RFC 2113) send socket failed: Bad file descriptor
Assertion failed: rc == 0 (connect_session.cpp:96)
Aborted

Actually I think that I was able to get this error in some other cases, without pgm:// — where user input may be sanitized. I will get back to you if I will be able to find that case.

agladysh commented 13 years ago

Note that the crash happens in the term().

Here is another one:

$ lua -l zmq -e 'print("V:", unpack(zmq.version())) ctx=zmq.init(2) c=assert(ctx:socket(zmq.SUB)) print("E:", c:bind("epgm://eth0;172.16.150.255:5555")) print("closing") c:close() print("term") ctx:term() print("done")'
V:  2   1   4
E:  true    nil
closing
term
Assertion failed: rc == 0 (connect_session.cpp:96)
Aborted
agladysh commented 13 years ago

But also on recv():

$ luajit2 -l zmq -e 'print("V:", unpack(zmq.version())) ctx=zmq.init(2) c=assert(ctx:socket(zmq.SUB)) print("E:", c:bind("epgm://eth0;172.16.150.255:5555")) print("recv") c:recv() print("closing") c:close() print("term") ctx:term() print("done")'
V:  2   1   4
E:  true    nil
recv
Assertion failed: rc == 0 (connect_session.cpp:96)
Aborted
agladysh commented 13 years ago

(Note that I know that the socket URLs are incorrect. My point is that lua-zmq should not crash with assertion, but should report error.)

Neopallium commented 13 years ago

This is an issue with ZeroMQ. Please report it to the ZeroMQ project.

agladysh commented 13 years ago

OK, done: https://github.com/zeromq/libzmq/issues/203