HomePhabricator

[SECP256K1] Avoid casting (void**) values.

Description

[SECP256K1] Avoid casting (void**) values.

Summary:

Replaced with an expression that only casts (void*) values.

While casting between void * and foo * generally allowed (upto alignment
issues), the same cannot be said for casting between void ** and foo **
values, which is not okay in general.

While the C standard which says "A pointer to void shall have the same
representation and alignment requirements as a pointer to a character
type.” likely implies the cast is sound because void * and char * values
have the same representation, perhaps it is better to rewrite the
expression to not require a careful reading of the standard to be
correct.

Backport of secp256k1#875

Test Plan:

ninja check-secp256k1

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

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

Details

Provenance
Russell O'Connor <roconnor@blockstream.io>Authored on Jan 23 2021, 20:22
FabienCommitted on Apr 8 2021, 13:21
FabienPushed on Apr 8 2021, 13:23
Reviewer
Restricted Project
Differential Revision
D9383: [SECP256K1] Avoid casting (void**) values.
Parents
rABC2098e555bf06: [SECP256K1] Autoconf improvements
Branches
Unknown
Tags
Unknown