Commit 8f46f152 authored by Max Kellermann's avatar Max Kellermann

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.
parent 46ab8d18
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment