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

fix out of range access #530

Merged
merged 1 commit into from
Oct 19, 2023
Merged

fix out of range access #530

merged 1 commit into from
Oct 19, 2023

Conversation

lievenhey
Copy link
Contributor

start was set to current + 1 which will cause undefined behavior if current is the last element
this patch adds a check for this and wraps around in that case

fixes: #526

@lievenhey
Copy link
Contributor Author

I have to check the output of the appimage build since the warning is only shown there

Copy link
Member

@milianw milianw left a comment

Choose a reason for hiding this comment

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

add a test for this case please

@lievenhey
Copy link
Contributor Author

How do I test this? Since gcc 5 std::find_if returns end if begin > end (figured out by playing with godbolt, since this error only happens on old compilers)

@lievenhey lievenhey force-pushed the fix-search-undef branch 2 times, most recently from 47507d6 to 5672127 Compare October 19, 2023 09:51
src/models/search.h Outdated Show resolved Hide resolved
start was set to current + 1 which will cause undefined behavior if
current is the last element
this patch adds a check for this and wraps around in that case

fixes: #526
@milianw milianw merged commit c19068f into master Oct 19, 2023
23 checks passed
@milianw milianw deleted the fix-search-undef branch October 19, 2023 12:16
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.

model search test: out of bounds compile warning
2 participants