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

EnumMapper: Fix out-of-bounds read #608

Closed
wants to merge 1 commit into from

Conversation

frankplow
Copy link
Contributor

This PR closes issue #607. Read there for some more details of the issue.

Defer dereferencing the component iterators (itItem and itName) of EnumMapper::Iterator until EnumMapper::Iterator itself is dereferenced. This prevents an out-of-bounds read when constructing an EnumMapper::Iterator from ::end() iterators.

Been a while since I've done any of this C++ STL stuff, so wouldn't mind some feedback. In particular, I wasn't sure the best way to make operator-> work. The std::unique_ptr approach I've taken at the moment should work, despite not really returning anything that points to the internal values of the EnumMapper::Iterator — seeing as the returned pointer is marked const this doesn't really matter.

Defer dereferencing the component iterators (itItem and itName) of
EnumMapper::Iterator until EnumMapper::Iterator itself is dereferenced.
This prevents an out-of-bounds read when constructing an
EnumMapper::Iterator from ::end() iterators.
@ChristianFeldmann
Copy link
Member

Different solution implemented in #610

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.

2 participants