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

Improvements around unsafe #2556

Merged
merged 2 commits into from
Feb 28, 2024
Merged

Improvements around unsafe #2556

merged 2 commits into from
Feb 28, 2024

Conversation

nazar-pc
Copy link
Member

I was auditing code in my head and found a few places where memory can hypothetically leak and a few tiny optimizations.

Code contributor checklist:

@nazar-pc nazar-pc added the need to audit This change needs to be audited label Feb 26, 2024
@nazar-pc nazar-pc requested a review from rg3l3dr as a code owner February 26, 2024 16:03
@nazar-pc nazar-pc enabled auto-merge February 26, 2024 17:27
@nazar-pc nazar-pc added this pull request to the merge queue Feb 28, 2024
Merged via the queue into main with commit 2040ac1 Feb 28, 2024
22 checks passed
@nazar-pc nazar-pc deleted the improvements-around-unsafe branch February 28, 2024 08:34
@@ -261,6 +257,8 @@ pub fn recover_extended_record_chunks(
erasure_coding: &ErasureCoding,
) -> Result<Box<[Scalar; Record::NUM_S_BUCKETS]>, ReadingError> {
// Restore source record scalars
// TODO: Recover into `Box<[Scalar; Record::NUM_S_BUCKETS]>` or else conversion into `Box` below
// might leak memory
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like a rather important TODO. Is there a follow up PR to this?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is essentially an upstream https://github.com/sifraitech/rust-kzg improvement. It is not that critical and basically means that compiler allocator can allocate more memory than necessary. See https://blog.polybdenum.com/2024/01/17/identifying-the-collect-vec-memory-leak-footgun.html for example of such issue. I don't think it is a big deal here and didn't notice issues related to this, just noted something we can improve in the future.

@vanhauser-thc vanhauser-thc added audited This change was audited and removed need to audit This change needs to be audited labels Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audited This change was audited
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants