Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New check: eraseIteratorOutOfBounds #5913

Merged
merged 15 commits into from
Feb 4, 2024

Conversation

chrchr-github
Copy link
Collaborator

No description provided.

@chrchr-github
Copy link
Collaborator Author

chrchr-github commented Jan 24, 2024

Why would we set the ITERATOR_END value for end() - 1? Or is it meant to be interpreted together with the intvalue?

@chrchr-github chrchr-github marked this pull request as ready for review January 29, 2024 13:19
lib/checkstl.cpp Outdated Show resolved Hide resolved
@pfultz2
Copy link
Contributor

pfultz2 commented Jan 29, 2024

Why would we set the ITERATOR_END value for end() - 1?

The ITERATOR_END is the position from the end. So end() - 1 should have intvalue of -1. We can also check if the end iterator is out of range if its less than -size().

lib/checkstl.cpp Outdated Show resolved Hide resolved
@chrchr-github chrchr-github changed the title New check: erasing end() New check: eraseIteratorOutOfBounds Jan 29, 2024
lib/checkstl.cpp Outdated Show resolved Hide resolved
lib/checkstl.cpp Outdated Show resolved Hide resolved
lib/checkstl.h Show resolved Hide resolved
lib/checkstl.cpp Outdated Show resolved Hide resolved
Copy link
Owner

@danmar danmar left a comment

Choose a reason for hiding this comment

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

lgtm

@orbitcowboy orbitcowboy merged commit faaabb1 into danmar:main Feb 4, 2024
64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants