]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
capmt: fix endless loop
authorMariusz Bialonczyk <manio@skyboo.net>
Fri, 13 Mar 2015 12:16:53 +0000 (13:16 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sun, 22 Mar 2015 14:50:05 +0000 (15:50 +0100)
When tvh receives less then 4 bytes from the socket for some reason,
it stuck in the endless loop in handle_single() calling:
capmt_msg_size()
capmt_analyze_cmd()
The capmt thread eats 100% CPU and cannot be normally terminated
because the capmt_msg_size() was constantly returning 0.

The commit fixes the problem.

src/descrambler/capmt.c

index 818ef7a5b67270b4cd49e5f3f71735675ecb4843..b850dc14576677c20db1a35d2a050d2d2202891c 100644 (file)
@@ -1372,7 +1372,7 @@ handle_single(capmt_t *capmt)
        }
         if (adapter < MAX_CA) {
           cmd_size = capmt_msg_size(capmt, &buffer, offset);
-          if (cmd_size >= 0)
+          if (cmd_size > 0)
             break;
         }
         sbuf_cut(&buffer, 1);