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 358156 - in udpsrc.c gst_udpsrc_create function read command could loop
in udpsrc.c gst_udpsrc_create function read command could loop
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal normal
: 0.10.5
Assigned To: Wim Taymans
GStreamer Maintainers
Depends on:
Reported: 2006-09-28 16:57 UTC by Antoine Tremblay
Modified: 2006-09-29 08:11 UTC
See Also:
GNOME target: ---
GNOME version: ---

Path to fix the loop problem (415 bytes, patch)
2006-09-28 16:57 UTC, Antoine Tremblay
committed Details | Review

Description Antoine Tremblay 2006-09-28 16:57:05 UTC
The problem was that to check if there was any command left of the pipe the result of the read was compared with < 0 when read can return 0 and have no more data (-1 is an error)

See from the man : " If count is zero, read() returns zero and has no other results." ... " On  success,  the  number of bytes read is returned (zero indicates end of file "

So I modifded the 

 READ_COMMAND (udpsrc, command, res);
          if (res < 0) {
            GST_LOG_OBJECT (udpsrc, "no more commands");
            /* no more commands */

with a res <= 0
Comment 1 Antoine Tremblay 2006-09-28 16:57:38 UTC
Created attachment 73572 [details] [review]
Path to fix the loop problem
Comment 2 Wim Taymans 2006-09-29 08:11:26 UTC
Indeed, thanks! There are a few other elements where a similar piece of code is equally wrong.

        Patch by: Antoine Tremblay <hexa00 at gmail dot com>

        * gst/udp/gstudpsrc.c: (gst_udpsrc_create):
        Fix possible infinite loop when shutting down, a read can also return
        0 to indicate no more messages are available. Fixes #358156.