Merge #889: fix uninitialized read in tests
99a1cfec17
print warnings for conditional-uninitialized (PiRK)3d2cf6c5bd
initialize variable in tests (PiRK) Pull request description: ACKs for top commit: real-or-random: ACK99a1cfec17
code inspection jonasnick: ACK99a1cfec17
Tree-SHA512: 72f92f51c44210ab54f166920f540525db0e3d1f19a2fa56e4a6d157a38a582f9dc649d919cf3278482c9fd723021b07759284a8fccbc574b62a22aac0facf51
This commit is contained in:
commit
1e5d50fa93
|
@ -82,6 +82,15 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
|
|||
CFLAGS="$saved_CFLAGS"
|
||||
])
|
||||
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="-Wconditional-uninitialized $CFLAGS"
|
||||
AC_MSG_CHECKING([if ${CC} supports -Wconditional-uninitialized])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
|
||||
[ AC_MSG_RESULT([yes]) ],
|
||||
[ AC_MSG_RESULT([no])
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
])
|
||||
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="-fvisibility=hidden $CFLAGS"
|
||||
AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
|
||||
|
|
|
@ -4526,8 +4526,10 @@ void test_ecdsa_sign_verify(void) {
|
|||
secp256k1_scalar one;
|
||||
secp256k1_scalar msg, key;
|
||||
secp256k1_scalar sigr, sigs;
|
||||
int recid;
|
||||
int getrec;
|
||||
/* Initialize recid to suppress a false positive -Wconditional-uninitialized in clang.
|
||||
VG_UNDEF ensures that valgrind will still treat the variable as uninitialized. */
|
||||
int recid = -1; VG_UNDEF(&recid, sizeof(recid));
|
||||
random_scalar_order_test(&msg);
|
||||
random_scalar_order_test(&key);
|
||||
secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &pubj, &key);
|
||||
|
|
Loading…
Reference in New Issue