[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-
From: |
Bastiaan Jacques |
Subject: |
[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-1985-g45d6c4a |
Date: |
Thu, 15 May 2014 23:19:20 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".
The branch, master has been updated
via 45d6c4aaf0ed196172cf2b6d03d3e00cfbd3533e (commit)
from 1444541156bd163bdcd86779f605ef0fb884f711 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=45d6c4aaf0ed196172cf2b6d03d3e00cfbd3533e
commit 45d6c4aaf0ed196172cf2b6d03d3e00cfbd3533e
Author: Bastiaan Jacques <address@hidden>
Date: Fri May 16 01:14:07 2014 +0200
Savannah #42372: Avoid UB in integer overflow.
diff --git a/libbase/RTMP.cpp b/libbase/RTMP.cpp
index 17b7552..f99d9fe 100644
--- a/libbase/RTMP.cpp
+++ b/libbase/RTMP.cpp
@@ -1157,14 +1157,21 @@ encodeInt24(boost::uint8_t *output, boost::uint8_t
*outend, int nVal)
boost::uint32_t
getUptime()
{
+ // This function returns the uptime in milliseconds, which necessarily
+ // overflows uint32_t after ~50 days. Because the result is used for
+ // timestamping this is not a big problem, assuming a single RTMP session
+ // won't last that long. We ensure the overflow happens in a manner
+ // avoiding undefined behaviour.
+ const boost::uint32_t max = std::numeric_limits<boost::uint32_t>::max();
+
#if !defined(_WIN32) && !defined(__amigaos4__)
struct tms t;
- return times(&t) * 1000 / sysconf(_SC_CLK_TCK);
+ return (times(&t) * (1000ULL / sysconf(_SC_CLK_TCK))) % max;
#elif defined(__amigaos4__)
struct tms t;
- return times(&t) * 1000 / 50;
+ return (times(&t) * (1000ULL / 50)) % max;
#else
- return std::clock() * 100 / CLOCKS_PER_SEC;
+ return (std::clock() * (100ULL / CLOCKS_PER_SEC) % max;
#endif
}
-----------------------------------------------------------------------
Summary of changes:
libbase/RTMP.cpp | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
hooks/post-receive
--
Gnash
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-1985-g45d6c4a,
Bastiaan Jacques <=