SIGN IN SIGN UP

fix: Avoid unaligned uint16_t load in EIP-712 field_hash_prepare

field_hash_prepare() read the 2-byte declared-size prefix of an
EIP-712 dynamic field with `*(uint16_t *) &data[0]`. data points
into the APDU buffer and is not guaranteed to be 2-byte aligned,
which is undefined behavior on strict-alignment ARM targets and
risks a bus fault depending on incoming chunk boundaries.

Use the SDK's read_u16_be() helper, which does a byte-by-byte big-
endian decode and works regardless of alignment, removing both the
UB and the __builtin_bswap16() that was paired with it.

(cherry picked from commit 1954a35309076e53fabf19e1b94b346635dd8113)
C
Charles-Edouard de la Vergne committed
01350296884b77a5c8717c4d36d79f874cb82d09
Parent: cab77ad
Committed by Alexandre Paillier <alexandre.paillier@ledger.fr> on 8/25/2026, 3:03:58 PM