Skip to content

Commit d97f224

Browse files
authored
Update Timer_List_T.cpp
Since increasing id_counter_ can lead to an overflow, we propose adding an overflow check.
1 parent 35d84b4 commit d97f224

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

ACE/ace/Timer_List_T.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,15 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::schedule_i (const TYPE &
210210

211211
if (n != 0)
212212
{
213-
long id = this->id_counter_++;
214-
213+
long id = this->id_counter_;
214+
if (this->id_counter_ < LONG_MAX)
215+
{
216+
this->id_counter_++;
217+
}
218+
else
219+
{
220+
this->id_counter_ = 0;
221+
}
215222
if (id != -1) {
216223
n->set (type, act, future_time, interval, 0, 0, id);
217224
this->schedule_i (n, future_time);

0 commit comments

Comments
 (0)