Page MenuHomePhabricator

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

Authored by Fabien on Apr 8 2021, 13:06.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Commits
rABC882ec0ad4694: [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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable