Fix cksum oom panic#12930
Closed
killuazoldyck680 wants to merge 10 commits into
Closed
Conversation
sylvestre
reviewed
Jun 16, 2026
| Ok(0) => Ok(None), | ||
| Ok(l) => Ok(Some(HashLength::from_bits(l))), | ||
| Ok(l) => { | ||
| let bytes_needed = (l + 7) / 8; |
Contributor
There was a problem hiding this comment.
what is 7 and 8 ?
it should be documented
sylvestre
reviewed
Jun 16, 2026
| let bytes_needed = (l + 7) / 8; | ||
|
|
||
| let mut test_buffer: Vec<u8> = Vec::new(); | ||
| let safety_cushion = bytes_needed.saturating_add(65536); |
sylvestre
reviewed
Jun 16, 2026
| let safety_cushion = bytes_needed.saturating_add(65536); | ||
|
|
||
| if test_buffer.try_reserve(safety_cushion).is_err() { | ||
| return Err(uucore::error::USimpleError::new(1, "memory exhausted")); |
sylvestre
reviewed
Jun 16, 2026
| false-help-text = Print help information | ||
| false-version-text = Print version information | ||
Contributor
|
@sylvestre Please review #12925 (comment) . We probably should not label "good 1st issue" for OOM issue. |
|
GNU testsuite comparison: |
Author
|
thank you for pointing out the mistakes @sylvestre will try work on these. |
62ad251 to
3d5a6b9
Compare
Author
|
hey, another set of changes, these should be more in line with the ones you requested. Changes made
|
9b99661 to
b17b605
Compare
for more information, see https://pre-commit.ci
Contributor
|
|
Contributor
|
Sorry. But this approach is not acceptible. But if you still want to try this, please change the approach in #12931 to propagate err. |
Author
|
hey, @oech3 thanks for replying, will try a different approach. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey made some more changes, a review would be helpful
Instead of allowing the process to panic and trigger an kernel abort (
Aborted (core dumped)), I have implemented atry_reservecheck with a safety cushion inside the parsing stage. If memory allocation is bound to fail, it now gracefully returns a cleancksum: memory exhaustederror string.@oech3 (I've updated the logic to handle the specific test scenario you requested!)
Fixes #12869