Skip to content

fix out of range access#530

Merged
milianw merged 1 commit intomasterfrom
fix-search-undef
Oct 19, 2023
Merged

fix out of range access#530
milianw merged 1 commit intomasterfrom
fix-search-undef

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
Collaborator

@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
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
@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