Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge dashpay#699: Initialize field elements when resulting in infinity
47a7b83 Clear field elements when writing infinity (Elichai Turkel) 61d1ecb Added test with additions resulting in infinity (Elichai Turkel) Pull request description: Currently if `secp256k1_gej_add_var` / `secp256k1_gej_add_ge_var` /` secp256k1_gej_add_zinv_var` receive `P + (-P)` it will set `gej->infinity = 1` but doesn't call initialize the field elements. Notice that this is the only branch in the function that results in an uninitialized output. By using `secp256k1_gej_set_infinity()` it will set the field elements to zero while also setting the infinity flag. I also added a test that fails with valgrind on current master but passes with the fix. EDIT: This isn't a bug or something necessary, I just personally found this helpful. ACKs for top commit: real-or-random: ACK 47a7b83 Tree-SHA512: cdc2efc242a1b04b4f081183c07d4b2602cdba705e6b30b548df4e115e54fb97691f4b1a28f142f02d5e523c020721337a297b17d732acde147b910f5c53bd0a
- Loading branch information