Repository navigation
fix: reject a malformed inner checksum instead of crashing - #264
Merged
Merged
Conversation
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.
hex_tarball:unpack/2raisesfunction_clauseinstead of returning{error, _}when the inner CHECKSUM holds a non-hex byte:check_inner_checksum/1callsdecode_base16/1before validating, andunhex/1has no catch-all clauserepro: a valid tarball with
CHECKSUM = <<"zz">>crashesunpack/2on mainFixed by validating the CHECKSUM is 64 hex chars before decoding so a bad one now return
{error, {tarball, invalid_inner_checksum}}-- valid tarballs are unaffected and i added a case tounpack_error_handling_testnote:
unpack/2is documented as{ok,_}|{error,_}, so the raise defeats error handling in consumers, e.g.mix deps.getaborts uncaught and the hex.pm server 500s on a malformed uploaded tarball, rebar3 only avoids it via a broad outer catch