GNOME Bugzilla – Bug 666644
udpsrc: infinite loop on dataless UDP packets
Last modified: 2011-12-27 11:52:25 UTC
Created attachment 204028 [details] [review] this patch avoids the infinite loop It is allowed to send/receive UDP packets with no data. When such a packet is available, select() will return with success but ioctl(FIONREAD) will return 0. But a read() must still occur in order to clear off the UDP packet from the queue. This patch will read the dataless packet from the socket. If select() was woken for other reasons (and FIONREAD returns 0), this may result in a UDP packet getting accidentally dropped. But since UDP is not reliable, this is acceptable. NOTE: This patch fixes a nasty bug where sending a dataless UDP packet to a udpsrc instance will cause an infinite loop.
Ouch, thanks for the bug report and patch! commit 86cd5bd7f2b0fe5aa594a94536dee0bd7d715798 Author: Tim-Philipp Müller <tim.muller@collabora.co.uk> Date: Tue Dec 27 11:50:03 2011 +0000 udpsrc: fix valgrind warning https://bugzilla.gnome.org/show_bug.cgi?id=666644 commit b744ad03ccf85cfe34f00866964fc97fad385975 Author: Tim-Philipp Müller <tim.muller@collabora.co.uk> Date: Tue Dec 27 11:49:10 2011 +0000 udpsrc: add unit test that sends 0-size packet https://bugzilla.gnome.org/show_bug.cgi?id=666644 commit 0c4b60f01044e097d30095ceb3b7c65e57126a8f Author: John Ogness <john.ogness@linutronix.de> Date: Wed Dec 21 13:22:03 2011 +0100 udpsrc: drop dataless UDP packets It is allowed to send/receive UDP packets with no data. When such a packet is available, select() will return with success but ioctl(FIONREAD) will return 0. But a read() must still occur in order to clear off the UDP packet from the queue. This patch will read the dataless packet from the socket. If select() was woken for other reasons (and FIONREAD returns 0), this may result in a UDP packet getting accidentally dropped. But since UDP is not reliable, this is acceptable. NOTE: This patch fixes a nasty bug where sending a dataless UDP packet to a udpsrc instance will cause an infinite loop. https://bugzilla.gnome.org/show_bug.cgi?id=666644 Signed-off-by: John Ogness <john.ogness@linutronix.de>