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: Heap Buffer Overflow #169

Merged
merged 1 commit into from
Aug 3, 2019

Conversation

ax3l
Copy link
Contributor

@ax3l ax3l commented Aug 2, 2019

Fix a memory violation when run in serial.

Found via gcc's -fsanitize=address sanitizer.

Copy link
Collaborator

@johnbent johnbent left a comment

Choose a reason for hiding this comment

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

Excellent. But I think it’d be slightly cleaner if line 264 was simply ‘ret = 1’. In fact, if num_ranks is 1, there is no need for any of the MPI communications in this function.

@ax3l
Copy link
Contributor Author

ax3l commented Aug 3, 2019

Oh yes, fully agree. In fact, I was a bit confused why it reduces to index 1 anyway.
I cannot simply return there, to avoid leaks, but we could return earlier.

Fix a memory violation when run in serial.
@ax3l ax3l force-pushed the fix-singleRankHeapBufferOverflow branch from 656bf25 to b72b51b Compare August 3, 2019 04:34
@ax3l
Copy link
Contributor Author

ax3l commented Aug 3, 2019

Not sure if I complicate the source further with early returns since also some logs are written here. Probably it's clearer already with the last push?

@JulianKunkel
Copy link
Collaborator

I think this is alright, given the simplicity... Good catch.

@JulianKunkel JulianKunkel merged commit da5f091 into hpc:master Aug 3, 2019
@ax3l ax3l deleted the fix-singleRankHeapBufferOverflow branch August 4, 2019 22:46
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.

3 participants