pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/audio/musicpd patches/patch-src_system_Clock.cxx: Avoi...
details: https://anonhg.NetBSD.org/pkgsrc/rev/a6ecad5616fb
branches: trunk
changeset: 645279:a6ecad5616fb
user: pho <pho%pkgsrc.org@localhost>
date: Mon Jan 26 07:26:55 2015 +0000
description:
patches/patch-src_system_Clock.cxx: Avoid integer overflow in MonotonicClock{S,MS,US}
This is Darwin specific: the original implementation was causing an
integer overflow when base.numer was very large. On PPC Darwin, the
timebase is 1000000000/33330116 and this is too large for integer
arithmetic.
http://bugs.musicpd.org/view.php?id=4292
diffstat:
audio/musicpd/Makefile | 3 +-
audio/musicpd/distinfo | 3 +-
audio/musicpd/patches/patch-src_system_Clock.cxx | 46 ++++++++++++++++++++++++
3 files changed, 50 insertions(+), 2 deletions(-)
diffs (76 lines):
diff -r 91199df31e96 -r a6ecad5616fb audio/musicpd/Makefile
--- a/audio/musicpd/Makefile Mon Jan 26 07:25:42 2015 +0000
+++ b/audio/musicpd/Makefile Mon Jan 26 07:26:55 2015 +0000
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.100 2015/01/18 17:36:21 wiz Exp $
+# $NetBSD: Makefile,v 1.101 2015/01/26 07:26:55 pho Exp $
DISTNAME= mpd-0.19.8
+PKGREVISION= 1
PKGNAME= ${DISTNAME:S/mpd/musicpd/}
CATEGORIES= audio
MASTER_SITES= http://www.musicpd.org/download/mpd/0.19/
diff -r 91199df31e96 -r a6ecad5616fb audio/musicpd/distinfo
--- a/audio/musicpd/distinfo Mon Jan 26 07:25:42 2015 +0000
+++ b/audio/musicpd/distinfo Mon Jan 26 07:26:55 2015 +0000
@@ -1,8 +1,9 @@
-$NetBSD: distinfo,v 1.59 2015/01/26 04:17:53 pho Exp $
+$NetBSD: distinfo,v 1.60 2015/01/26 07:26:55 pho Exp $
SHA1 (mpd-0.19.8.tar.xz) = e5e325b666474bddec6c07502fa2dcf3710a42e3
RMD160 (mpd-0.19.8.tar.xz) = eec522d7a2ba4b91c0d7e2ca44bce3a14313a69d
Size (mpd-0.19.8.tar.xz) = 705108 bytes
SHA1 (patch-src_output_plugins_httpd_HttpdOutputPlugin.cxx) = b47d79cc49a27d732a7531e23d666bf9df748bec
+SHA1 (patch-src_system_Clock.cxx) = fb8aa263c78a15ab942324a987d6429c0b7b41fb
SHA1 (patch-src_util_Alloc.cxx) = 81540f213e274fa5b8d064c1c93e660047256961
SHA1 (patch-src_util_Alloc.hxx) = 841c8cf6c1b6a7e46ad0edf1eb31625c0ec6ea66
diff -r 91199df31e96 -r a6ecad5616fb audio/musicpd/patches/patch-src_system_Clock.cxx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/audio/musicpd/patches/patch-src_system_Clock.cxx Mon Jan 26 07:26:55 2015 +0000
@@ -0,0 +1,46 @@
+$NetBSD: patch-src_system_Clock.cxx,v 1.1 2015/01/26 07:26:55 pho Exp $
+
+Avoid integer overflow in MonotonicClock{S,MS,US}
+
+This is Darwin specific: the original implementation was causing an
+integer overflow when base.numer was very large. On PPC Darwin, the
+timebase is 1000000000/33330116 and this is too large for integer
+arithmetic.
+
+http://bugs.musicpd.org/view.php?id=4292
+
+--- src/system/Clock.cxx.orig 2015-01-26 06:16:36.000000000 +0000
++++ src/system/Clock.cxx
+@@ -40,8 +40,8 @@ MonotonicClockS(void)
+ if (base.denom == 0)
+ (void)mach_timebase_info(&base);
+
+- return (unsigned)((mach_absolute_time() * base.numer / 1000)
+- / (1000000 * base.denom));
++ return (unsigned)(((double)mach_absolute_time() * base.numer / 1000)
++ / base.denom / 1000000);
+ #elif defined(CLOCK_MONOTONIC)
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+@@ -62,8 +62,8 @@ MonotonicClockMS(void)
+ if (base.denom == 0)
+ (void)mach_timebase_info(&base);
+
+- return (unsigned)((mach_absolute_time() * base.numer)
+- / (1000000 * base.denom));
++ return (unsigned)(((double)mach_absolute_time() * base.numer)
++ / base.denom / 1000000);
+ #elif defined(CLOCK_MONOTONIC)
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+@@ -104,8 +104,8 @@ MonotonicClockUS(void)
+ if (base.denom == 0)
+ (void)mach_timebase_info(&base);
+
+- return ((uint64_t)mach_absolute_time() * (uint64_t)base.numer)
+- / (1000 * (uint64_t)base.denom);
++ return (uint64_t)(((double)mach_absolute_time() * base.numer)
++ / base.denom / 1000);
+ #elif defined(CLOCK_MONOTONIC)
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
Home |
Main Index |
Thread Index |
Old Index