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.
This commit is contained in:
parent
46ab8d18e2
commit
8f46f1520c
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user