aboutsummaryrefslogtreecommitdiffstats
path: root/prog/rotation.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2021-01-05 10:47:41 +0100
committerDmitry Vyukov <dvyukov@google.com>2021-01-05 11:16:20 +0100
commitc2de3766243ed8955ab83e59bd5e4d60cb81bac9 (patch)
tree2bbaa1b9d8189e5c2830e757c709705e342cc1e7 /prog/rotation.go
parent270cde8ebe422a3197eec97faf00d3f10b0b0148 (diff)
prog: fix oob panic in rotatorState.Select
Reported-by: ManhNDd Fixes #2372
Diffstat (limited to 'prog/rotation.go')
-rw-r--r--prog/rotation.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/prog/rotation.go b/prog/rotation.go
index 0171e6ace..544f22730 100644
--- a/prog/rotation.go
+++ b/prog/rotation.go
@@ -150,6 +150,9 @@ func (rs *rotatorState) Select() map[*Syscall]bool {
// However, a resource can be handled as dependency first, but then
// handled as top resource again. In such case we will still add calls
// that use this resource.
+ if len(rs.resources) == 0 {
+ return rs.Rotator.calls
+ }
for {
if len(rs.depQueue) == 0 && len(rs.calls) >= rs.goal || len(rs.calls) >= 2*rs.goal {
rs.calls, _ = rs.target.transitivelyEnabled(rs.calls)