MDEV-34063 tpool - integer overflow in multiplication.
When calculating next wakeup timepoint for the timer thread, with large thread_pool_stall_limit values, 32bit int overflow can happen. Fixed by making one operand 8 byte large. Also fixed the type of tick_interval to be unsigned, so it does not go negative for very thread_pool_stall_limit.
This commit is contained in:
parent
b18259ecf5
commit
88f49da8e0
@ -107,7 +107,7 @@ struct pool_timer_t
|
|||||||
mysql_cond_t cond;
|
mysql_cond_t cond;
|
||||||
volatile uint64 current_microtime;
|
volatile uint64 current_microtime;
|
||||||
std::atomic<uint64_t> next_timeout_check;
|
std::atomic<uint64_t> next_timeout_check;
|
||||||
int tick_interval;
|
uint tick_interval;
|
||||||
bool shutdown;
|
bool shutdown;
|
||||||
pthread_t timer_thread_id;
|
pthread_t timer_thread_id;
|
||||||
};
|
};
|
||||||
@ -577,7 +577,7 @@ static void* timer_thread(void *param)
|
|||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
set_timespec_nsec(ts,timer->tick_interval*1000000);
|
set_timespec_nsec(ts, timer->tick_interval*1000000LL);
|
||||||
mysql_mutex_lock(&timer->mutex);
|
mysql_mutex_lock(&timer->mutex);
|
||||||
err= mysql_cond_timedwait(&timer->cond, &timer->mutex, &ts);
|
err= mysql_cond_timedwait(&timer->cond, &timer->mutex, &ts);
|
||||||
if (timer->shutdown)
|
if (timer->shutdown)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user