Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Modifying a Collection while iterating over it results in undefined behavior.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

MSC06-J

Low

Probable

Medium

P4

L3

Automated Detection

Some static analysis tools can detect cases where an iterator is being used after the source container of the iterator is modified.

ToolVersionCheckerDescription
Parasoft Jtest
9.5BD.CO.ITMODImplemented
Include Page
Parasoft_V
Parasoft_V
CERT.MSC06.ITMODDo not modify collection while iterating over it
PVS-Studio

Include Page
PVS-Studio_V
PVS-Studio_V

V6053

Related Vulnerabilities

The Apache Harmony bug HARMONY-6236 documents an ArrayList breaking when given concurrent collections as input.

Bibliography

...


...