Skip to content

Commit

Permalink
ToolItemUpdater: fix possible Integer overflow
Browse files Browse the repository at this point in the history
Both DELAY and 1_000_000 are Integers. Multiplied they could exceed max
integer. Currently the DELAY is small enough to not overflow, but
changing the constant would silently overflow.
  • Loading branch information
EcljpseB0T authored and jukzi committed Dec 6, 2024
1 parent 9d544d5 commit a0a0ef8
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void updateContributionItems(Selector selector) {
if (timestampOfEarliestQueuedUpdate == 0) {
timestampOfEarliestQueuedUpdate = System.nanoTime();
}
if (System.nanoTime() - timestampOfEarliestQueuedUpdate > DELAY * 1_000_000) {
if (System.nanoTime() - timestampOfEarliestQueuedUpdate > DELAY * 1_000_000L) {
// runnable was not called within the last DELAY milliseconds, do it now.
// For scenario: a plugin is forcing that updateContributionItems is called
// again and again in less than given DELAY frequency. TimerExec would then
Expand Down

0 comments on commit a0a0ef8

Please sign in to comment.