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

Add sanity checks before allocations #22

Open
ecton opened this issue Oct 16, 2021 · 0 comments
Open

Add sanity checks before allocations #22

ecton opened this issue Oct 16, 2021 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@ecton
Copy link
Member

ecton commented Oct 16, 2021

Many times when reading data from disk, we read a length and immediately ask the OS to ensure a Vec can hold that much data, potentially resizing the Vec.

If there is an issue with the data on-disk, this could lead to attempting to allocate too much data. The subsequent read call will fail due to an EOF, if the allocation succeeds.

Before requesting a resize or reservation, we should check that the bytes requested are less than or equal to the number of bytes that remain in the reader.

@ecton ecton added enhancement New feature or request good first issue Good for newcomers labels Oct 16, 2021
@ecton ecton added this to To do in Khonsu Labs Roadmap via automation Oct 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Status: Todo
Development

No branches or pull requests

1 participant