Merge branch 'ps/weak-sha1-for-tail-sum-fix'

An earlier "csum-file checksum does not have to be computed with
sha1dc" topic had a few code paths that had initialized an
implementation of a hash function to be used by an unmatching hash
by mistake, which have been corrected.

* ps/weak-sha1-for-tail-sum-fix:
  ci: exercise unsafe OpenSSL backend
  builtin/fast-import: fix segfault with unsafe SHA1 backend
  bulk-checkin: fix segfault with unsafe SHA1 backend
maint
Junio C Hamano 2025-01-01 09:21:14 -08:00
commit 98422943f0
3 changed files with 3 additions and 2 deletions

View File

@ -1106,7 +1106,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
|| (pack_size + PACK_SIZE_THRESHOLD + len) < pack_size) || (pack_size + PACK_SIZE_THRESHOLD + len) < pack_size)
cycle_packfile(); cycle_packfile();


the_hash_algo->init_fn(&checkpoint.ctx); the_hash_algo->unsafe_init_fn(&checkpoint.ctx);
hashfile_checkpoint(pack_file, &checkpoint); hashfile_checkpoint(pack_file, &checkpoint);
offset = checkpoint.offset; offset = checkpoint.offset;



View File

@ -272,7 +272,7 @@ static int deflate_blob_to_pack(struct bulk_checkin_packfile *state,
OBJ_BLOB, size); OBJ_BLOB, size);
the_hash_algo->init_fn(&ctx); the_hash_algo->init_fn(&ctx);
the_hash_algo->update_fn(&ctx, obuf, header_len); the_hash_algo->update_fn(&ctx, obuf, header_len);
the_hash_algo->init_fn(&checkpoint.ctx); the_hash_algo->unsafe_init_fn(&checkpoint.ctx);


/* Note: idx is non-NULL when we are writing */ /* Note: idx is non-NULL when we are writing */
if ((flags & HASH_WRITE_OBJECT) != 0) if ((flags & HASH_WRITE_OBJECT) != 0)

View File

@ -17,6 +17,7 @@ linux-gcc)
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
;; ;;
linux-TEST-vars) linux-TEST-vars)
export OPENSSL_SHA1_UNSAFE=YesPlease
export GIT_TEST_SPLIT_INDEX=yes export GIT_TEST_SPLIT_INDEX=yes
export GIT_TEST_MERGE_ALGORITHM=recursive export GIT_TEST_MERGE_ALGORITHM=recursive
export GIT_TEST_FULL_IN_PACK_ARRAY=true export GIT_TEST_FULL_IN_PACK_ARRAY=true