From e2533724e8916f949402182731d30b86b8fdb9b3 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Wed, 8 Feb 2006 00:02:07 +0000 Subject: [PATCH] tstools: check for wrap arounds in length calculation --- lib/dvb/tstools.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/dvb/tstools.cpp b/lib/dvb/tstools.cpp index 1b7c5d92..bec17a56 100644 --- a/lib/dvb/tstools.cpp +++ b/lib/dvb/tstools.cpp @@ -169,6 +169,9 @@ int eDVBTSTools::calcLen(pts_t &len) if (!(m_begin_valid && m_end_valid)) return -1; len = m_pts_end - m_pts_begin; + /* wrap around? */ + if (len < 0) + len += 0x200000000LL; return 0; } @@ -179,6 +182,10 @@ int eDVBTSTools::calcBitrate() return -1; pts_t len_in_pts = m_pts_end - m_pts_begin; + + /* wrap around? */ + if (len_in_pts < 0) + len_in_pts += 0x200000000LL; off_t len_in_bytes = m_offset_end - m_offset_begin; if (!len_in_pts) -- 2.30.2