aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-11-18 21:29:03 +0100
committerMax Kellermann <max@duempel.org>2010-11-18 21:29:03 +0100
commit8f46f1520cdb3e3e131b2021ac40325f6bdda2c8 (patch)
treed3c80f6ae43c7451180896521524dc0b445e75b9
parent46ab8d18e2539359eadb48b323ee9cace8b3a65b (diff)
downloadmpd-8f46f1520cdb3e3e131b2021ac40325f6bdda2c8.tar.gz
mpd-8f46f1520cdb3e3e131b2021ac40325f6bdda2c8.tar.xz
mpd-8f46f1520cdb3e3e131b2021ac40325f6bdda2c8.zip
timer: fix integer overflow in timer_delay()
Fixes a regression: for output_plugin.delay(), we added a method to the timer class which returns the delay in milliseconds. This fails to detect negative values, because the unsigned integer is divided by 1000, and then casted to signed.
-rw-r--r--src/timer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/timer.c b/src/timer.c
index e125b1009..0b3b1198a 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -74,7 +74,7 @@ void timer_add(Timer *timer, int size)
unsigned
timer_delay(const Timer *timer)
{
- int64_t delay = (timer->time - now()) / 1000;
+ int64_t delay = (int64_t)(timer->time - now()) / 1000;
if (delay < 0)
return 0;