Skip to content

Race condition in delay node - splice with invalid index #5451

@Dennis-SEG

Description

@Dennis-SEG

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); }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions