HomePhabricator

[SECP256K1] Fix a valgrind issue in multisets

Description

[SECP256K1] Fix a valgrind issue in multisets

Summary:
This diff fixes a valgrind error: `Conditional jump or move depends on
uninitialised value(s)` in the multisets module.

This occurs in the case of a multiset becoming empty. The group element
representing the multiset value becomes inifinity, branching in a case
where the field elements will not be set. Just after the fields elements
are being normalized, triggering the valgrind error. This can occur in
the remove or the combine function.

This is actually not a real world issue, because the normalized value
will not be used: the infinity is special cased during multiset
finalization and handled correctly.

The path is covered for the remove function by the associated tests,
and I added a test case for the combine function.

Test Plan:

ninja check-secp256k1

valgrind ./tests 16

Ensure the issue is gone.

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D5430

Details

Provenance
FabienAuthored on Mar 4 2020, 17:11
deadalnixPushed on Mar 6 2020, 16:32
Reviewer
Restricted Project
Differential Revision
D5430: [SECP256K1] Fix a valgrind issue in multisets
Parents
rSTAGING792089422ada: [SECP256K1] Fix the kitware PPA timeouts issues on Travis
Branches
Unknown
Tags
Unknown
References
tag: phabricator/base/16806