Skip to content

Commit 83d0fa2

Browse files
committed
extrakeys: fix pubkey_sort_cmp test
Instead of providing CTX directly, pass a cmp_data object containing CTX. Otherwise, memory sanitizer fails with "use-of-uninitialized-value".
1 parent 6152622 commit 83d0fa2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/modules/extrakeys/tests_impl.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,9 @@ static void test_sort(void) {
605605
}
606606
secp256k1_pubkey_sort(CTX, pk_ptr, 5);
607607
for (j = 1; j < 5; j++) {
608-
CHECK(secp256k1_pubkey_sort_cmp(&pk_ptr[j - 1], &pk_ptr[j], CTX) <= 0);
608+
secp256k1_pubkey_sort_cmp_data cmp_data;
609+
cmp_data.ctx = CTX;
610+
CHECK(secp256k1_pubkey_sort_cmp(&pk_ptr[j - 1], &pk_ptr[j], &cmp_data) <= 0);
609611
}
610612
}
611613
}

0 commit comments

Comments
 (0)