aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2020-12-02 12:19:13 -0500
committerMichael Pratt <mpratt@google.com>2020-12-03 21:23:16 +0000
commitb78b427be5e4c8a51a2b01b39c1ce6c4f39a93dc (patch)
treebba69775729b570a1b49020c7a398ec508d151aa /test
parentb635e4b808bf45ebd66e9f687e18b9af6bd634c1 (diff)
downloadgo-b78b427be5e4c8a51a2b01b39c1ce6c4f39a93dc.tar.gz
go-b78b427be5e4c8a51a2b01b39c1ce6c4f39a93dc.zip
runtime, time: strictly enforce when, period constraints
timer.when must always be positive. addtimer and modtimer already check that it is non-negative; we expand it to include zero. Also upgrade from pinning bad values to throwing, as these values shouldn't be possible to pass (except as below). timeSleep may overflow timer.nextwhen. This would previously have been pinned by resetForSleep, now we fix it manually. runOneTimer may overflow timer.when when adding timer.period. Detect this and pin to maxWhen. addtimer is now too strict to allow TestOverflowRuntimeTimer to test an overflowed timer. Such a timer should not be possible; to help guard against accidental inclusion siftup / siftdown will check timers as it goes. This has been replaced with tests for period and sleep overflows. Change-Id: I17f9739e27ebcb20d87945c635050316fb8e9226 Reviewed-on: https://go-review.googlesource.com/c/go/+/274853 Trust: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'test')
0 files changed, 0 insertions, 0 deletions