Skip to content

Conversation

@hedrok
Copy link
Contributor

@hedrok hedrok commented Jul 10, 2025

Before this commit the wording was that modifying list works but is not recommended.

But it works as long as no two consecutive elements are deleted, otherwise part of elements is not checked at all without any exceptions raised.

Changed README.md, compliant01.py and noncompliant01.py to demonstrate that.

Before this commit the wording was that modifying list works but
is not recommended.

But it works as long as no two consecutive elements are deleted,
otherwise part of elements is not checked at all without any
exceptions raised.

Changed README.md, compliant01.py and noncompliant01.py to
demonstrate that.

Signed-off-by: Kyrylo Yatsenko <[email protected]>
Copy link
Contributor

@BartKaras1128 BartKaras1128 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I think this example is a more interesting way of showing that modification of a list in a loop can be dangerous and could have unexpected outcomes.
Approved by me.

Copy link
Contributor

@myteron myteron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @hedrok for the contribution. Much better example.

@myteron myteron merged commit beb89db into ossf:main Jul 15, 2025
2 checks passed
@hedrok hedrok deleted the CWE-1096-add-dangerous-list-example branch July 15, 2025 12:44
@hedrok
Copy link
Contributor Author

hedrok commented Jul 15, 2025

Thanks! :)

dwiley258 pushed a commit to dwiley258/wg-best-practices-os-developers that referenced this pull request Jul 31, 2025
Before this commit the wording was that modifying list works but
is not recommended.

But it works as long as no two consecutive elements are deleted,
otherwise part of elements is not checked at all without any
exceptions raised.

Changed README.md, compliant01.py and noncompliant01.py to
demonstrate that.

Signed-off-by: Kyrylo Yatsenko <[email protected]>
Signed-off-by: Helge Wehder <[email protected]>
Signed-off-by: ewlxdnx <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants