Skip to content

Commit 26af69a

Browse files
committed
Unknown checksum algorithms (based on length) are errors
1 parent abc69bd commit 26af69a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

bin/ruby-build

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ compute_md5() {
247247
}
248248

249249
verify_checksum() {
250-
local checksum_command="compute_sha2"
250+
local checksum_command
251251

252252
# If the specified filename doesn't exist, return success
253253
local filename="$1"
@@ -266,6 +266,9 @@ verify_checksum() {
266266
[ -n "$HAS_SHA2_SUPPORT" ] || return 0
267267
checksum_command="compute_sha2"
268268
;;
269+
*) # unknown checksum algorithm, return failure
270+
return 1
271+
;;
269272
esac
270273

271274
# If the computed checksum is empty, return failure
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
install_package "package-1.0.0" "http://example.com/packages/package-1.0.0.tar.gz#invalid" copy
1+
install_package "package-1.0.0" "http://example.com/packages/package-1.0.0.tar.gz#invalid_64_character_checksum_0000000000000000000000000000000000" copy

0 commit comments

Comments
 (0)