From 15ae6b620c83aaa84e835a01a565668a11e8cf01 Mon Sep 17 00:00:00 2001 From: Mark Calderbank Date: Sun, 25 Nov 2007 12:14:50 +0000 Subject: [PATCH] TS demuxer bug fixes --- demuxerts.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/demuxerts.cc b/demuxerts.cc index f06727b..c0d36fb 100644 --- a/demuxerts.cc +++ b/demuxerts.cc @@ -128,7 +128,7 @@ int DemuxerTS::put(UCHAR* buf, int len) } // Position ourselves at a candidate TS packet - while (*buf != TS_SIG && len) + while (len > 0 && *buf != TS_SIG) { Log::getInstance()->log("TS Demuxer", Log::ERR, "TS Misaligned!"); buf++; ret++; len--; @@ -146,7 +146,8 @@ int DemuxerTS::put(UCHAR* buf, int len) if (buf[TS_SIZE] != TS_SIG) { // Not terminated correctly. - while (*buf != TS_SIG && len) + buf++; ret++; len--; + while (len > 0 && *buf != TS_SIG) { buf++; ret++; len--; } -- 2.39.5