From: Felix Domke Date: Wed, 8 Feb 2006 00:02:07 +0000 (+0000) Subject: tstools: check for wrap arounds in length calculation X-Git-Tag: 2.6.0~4181 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/e2533724e8916f949402182731d30b86b8fdb9b3 tstools: check for wrap arounds in length calculation --- 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)