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 invalid memory access when reading colour maps #2974

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

daljit46
Copy link
Member

In 6286158, as part of #2911, ColourMap::maps was converted from a null-terminated C array to a std::vector. However, the loops iterating over this list weren't updated and were still relying on null-termination causing an invalid memory access. This also resulted mrview crashing on MacOS.
@bjeurissen Could you check if this fixes the crash on your system?

Copy link

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
Copy link

clang-tidy review says "All clean, LGTM! 👍"

In 6286158, as part of #2911,
ColourMap::maps was converted from a null-terminated C array to a
std::vector. However, the loops iterating over this list weren't updated
and were still relying on null-termination causing an invalid memory
access. This also resulted mrview crashing on MacOS.
Copy link
Member

@bjeurissen bjeurissen left a comment

Choose a reason for hiding this comment

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

Works!

@bjeurissen bjeurissen merged commit b830008 into dev Aug 21, 2024
6 of 7 checks passed
@bjeurissen bjeurissen deleted the fix_invalid_mem_access branch August 21, 2024 11:27
Copy link

clang-tidy review says "All clean, LGTM! 👍"

@daljit46
Copy link
Member Author

daljit46 commented Aug 23, 2024

Mentioning this for bookkeeping: the changes in this PR have been rebased in dev following discussion in #2859.

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