Summary
The delay node can incorrectly modify its idList array when indexOf() returns -1.
Problem
In three locations, the code does:
node.idList.splice(node.idList.indexOf(id), 1);
If id is not found, indexOf() returns -1, and splice(-1, 1) removes the last element instead of doing nothing.
Affected Lines
- Line 162 (delay mode)
- Line 187 (delayv mode)
- Line 210 (random mode)
Severity
MEDIUM - Can cause incorrect message timing or lost messages when timeouts are cleared/flushed.
Proposed Fix
Check the indexOf result before splicing:
var idx = node.idList.indexOf(id);
if (idx !== -1) { node.idList.splice(idx, 1); }