diff --git a/.whitesource b/.whitesource new file mode 100644 index 0000000000..f340c5defc --- /dev/null +++ b/.whitesource @@ -0,0 +1,8 @@ +########################################################## +#### WhiteSource Integration configuration file #### +########################################################## + +# Configuration # +#---------------# +ws.repo.scan=true +vulnerable.check.run.conclusion.level=failure diff --git a/tos/lib/timer/VirtualizeTimerC.nc b/tos/lib/timer/VirtualizeTimerC.nc index 6f6fc577d7..529b11dee0 100644 --- a/tos/lib/timer/VirtualizeTimerC.nc +++ b/tos/lib/timer/VirtualizeTimerC.nc @@ -105,6 +105,7 @@ implementation runtime cost). */ uint32_t now = call TimerFrom.getNow(); int32_t min_remaining = (1UL << 31) - 1; /* max int32_t */ + int32_t max_int32 = min_remaining; bool min_remaining_isset = FALSE; uint16_t num; @@ -119,6 +120,15 @@ implementation uint32_t elapsed = now - timer->t0; int32_t remaining = timer->dt - elapsed; + /* If the value of timer's destination greater than max int32_t, + then the virtual timer is ignored to avoid the fact that all + of other tasks is hard to get runing time and the battery is + quickly exhausted. And the system may crash.*/ + if(timer->dt > max_int32) { + dbg("Value error", "The timer's destination value is too high\n"); + continue; + } + if (remaining < min_remaining) { min_remaining = remaining;