From 3ff4fd923beacfe1bc3ff7cbb497fc80c25e0b94 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 23 Feb 2014 14:38:58 +0100 Subject: [PATCH] libtriple: do not read from invalid dmx --- libtriple/dmx_td.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libtriple/dmx_td.cpp b/libtriple/dmx_td.cpp index d739277..d86a887 100644 --- a/libtriple/dmx_td.cpp +++ b/libtriple/dmx_td.cpp @@ -270,6 +270,14 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) ufds.events = POLLIN; ufds.revents = 0; + if (dmx_type == DMX_INVALID) /* happens, if too many DMX_TP are requested, because */ + { /* nobody checks the return value of Open or Start... */ + lt_debug("%s #%d: DMX_INVALID\n", __func__, num); + usleep(timeout * 1000); /* rate-limit the debug message */ + errno = EINVAL; + return -1; + } + if (P->measure) { if (timeout)