After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 666644 - udpsrc: infinite loop on dataless UDP packets
udpsrc: infinite loop on dataless UDP packets
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal major
: 0.10.31
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-12-21 12:36 UTC by John Ogness
Modified: 2011-12-27 11:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
this patch avoids the infinite loop (2.21 KB, patch)
2011-12-21 12:36 UTC, John Ogness
committed Details | Review

Description John Ogness 2011-12-21 12:36:28 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.
Comment 1 Tim-Philipp Müller 2011-12-27 11:52:10 UTC
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>