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

cryptovec: Fix a segmentation fault #288

Merged
merged 1 commit into from
May 25, 2024
Merged

Conversation

elegaanz
Copy link
Contributor

The CryptoVec::resize implementation was running into a segmentation fault in some case. If the capacity of the vector was more than 0, and that the new allocation failed, the call to std::ptr::copy_non_overlapping would have a null pointer as destination. This was very easy to trigger by a malicious peer, they just had to send a packet with an announced size large enough for the allocation to fail. The code now correctly panics, which would only end the current thread and not crash the whole application without giving it a chance to continue running.

@Eugeny Eugeny merged commit e4584a4 into Eugeny:main May 25, 2024
4 checks passed
@Eugeny
Copy link
Owner

Eugeny commented May 25, 2024

Thank you!

@Eugeny
Copy link
Owner

Eugeny commented May 25, 2024

@all-contributors please add @elegaanz for code

Copy link
Contributor

@Eugeny

I've put up a pull request to add @elegaanz! 🎉

Eugeny pushed a commit that referenced this pull request May 25, 2024
Adds @elegaanz as a contributor for code.

This was requested by Eugeny [in this
comment](#288 (comment))

[skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
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