From 674e72439720d7936c521bfd0dc985b51df861a2 Mon Sep 17 00:00:00 2001 From: Michael Brehm Date: Sat, 1 Dec 2018 18:09:21 -0500 Subject: [PATCH] Fix bug in DVR stream packet filter causing an access violation if a PSI packet with a table ID of 0xFF is encountered --- pvr.hdhomerundvr/changelog.txt | 3 +++ src/dvrstream.cpp | 6 +++++- src/version.ini | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pvr.hdhomerundvr/changelog.txt b/pvr.hdhomerundvr/changelog.txt index a0d59d9b..0ba9fe88 100644 --- a/pvr.hdhomerundvr/changelog.txt +++ b/pvr.hdhomerundvr/changelog.txt @@ -1,3 +1,6 @@ +v1.3.6 (2018.12.01) + - Fix bug in DVR stream packet filter causing an access violation if a PSI packet with a table ID of 0xFF is encountered + v1.3.5 (2018.10.13) - Update SQLite database engine to version 3.25.2 - Automatically delete and recreate the PVR database if any exceptions occur opening it during startup diff --git a/src/dvrstream.cpp b/src/dvrstream.cpp index 5a3a1a13..9c781f83 100644 --- a/src/dvrstream.cpp +++ b/src/dvrstream.cpp @@ -538,6 +538,10 @@ void dvrstream::filter_packets(uint8_t* buffer, size_t count) // Align the payload using the pointer provided when pusi is set if(pusi) current += read_be8(current) + 1U; + // Watch out for a TABLEID of 0xFF, this indicates that the remainder + // of the packet is just stuffed with 0xFF and nothing useful is here + if(read_be8(current) == 0xFF) continue; + // Get the first and last section indices and skip to the section data uint8_t firstsection = read_be8(current + 6U); uint8_t lastsection = read_be8(current + 7U); @@ -554,7 +558,7 @@ void dvrstream::filter_packets(uint8_t* buffer, size_t count) } // >> PMT - if((pusi) && (payload) && (m_pmtpids.find(pid) != m_pmtpids.end())) { + else if((pusi) && (payload) && (m_pmtpids.find(pid) != m_pmtpids.end())) { // Get the length of the entire payload to be sure we don't exceed it size_t payloadlen = MPEGTS_PACKET_LENGTH - (current - packet); diff --git a/src/version.ini b/src/version.ini index e1d0ab7d..63a0f146 100644 --- a/src/version.ini +++ b/src/version.ini @@ -8,4 +8,4 @@ Company=Michael G. Brehm Copyright= Product=zuki.pvr.hdhomerundvr -Version=1.3.5 +Version=1.3.6