Skip to content

Commit d7ec49a

Browse files
committed
Merge bitcoin-core/secp256k1#969: ci: Fixes after Debian release
5d5c74a tests: Rewrite code to circument potential bug in clang (Tim Ruffing) 3d2f492 ci: Install libasan6 (instead of 5) after Debian upgrade (Tim Ruffing) Pull request description: ACKs for top commit: jonasnick: ACK 5d5c74a Tree-SHA512: 540ede482214bf9feaa607de52a69f6d34169dd98fb14bd3d003f4c8f722c1eebed56eb9d933e742f36d8886c25bfa9fa0ebbed5b0c3b161f04dc26180f5d214
2 parents be8d9c2 + 5d5c74a commit d7ec49a

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

ci/linux-debian.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN apt-get install --no-install-recommends --no-upgrade -y \
1414
make automake libtool pkg-config dpkg-dev valgrind qemu-user \
1515
gcc clang llvm libc6-dbg \
1616
g++ \
17-
gcc-i686-linux-gnu libc6-dev-i386-cross libc6-dbg:i386 libubsan1:i386 libasan5:i386 \
17+
gcc-i686-linux-gnu libc6-dev-i386-cross libc6-dbg:i386 libubsan1:i386 libasan6:i386 \
1818
gcc-s390x-linux-gnu libc6-dev-s390x-cross libc6-dbg:s390x \
1919
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross libc6-dbg:armhf \
2020
gcc-aarch64-linux-gnu libc6-dev-arm64-cross libc6-dbg:arm64 \

src/tests.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5262,17 +5262,19 @@ void test_ecdsa_sign_verify(void) {
52625262
secp256k1_scalar msg, key;
52635263
secp256k1_scalar sigr, sigs;
52645264
int getrec;
5265-
/* Initialize recid to suppress a false positive -Wconditional-uninitialized in clang.
5266-
VG_UNDEF ensures that valgrind will still treat the variable as uninitialized. */
5267-
int recid = -1; VG_UNDEF(&recid, sizeof(recid));
5265+
int recid;
52685266
random_scalar_order_test(&msg);
52695267
random_scalar_order_test(&key);
52705268
secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &pubj, &key);
52715269
secp256k1_ge_set_gej(&pub, &pubj);
52725270
getrec = secp256k1_testrand_bits(1);
5273-
random_sign(&sigr, &sigs, &key, &msg, getrec?&recid:NULL);
5271+
/* The specific way in which this conditional is written sidesteps a potential bug in clang.
5272+
See the commit messages of the commit that introduced this comment for details. */
52745273
if (getrec) {
5274+
random_sign(&sigr, &sigs, &key, &msg, &recid);
52755275
CHECK(recid >= 0 && recid < 4);
5276+
} else {
5277+
random_sign(&sigr, &sigs, &key, &msg, NULL);
52765278
}
52775279
CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sigr, &sigs, &pub, &msg));
52785280
secp256k1_scalar_set_int(&one, 1);

0 commit comments

Comments
 (0)