What changed, and why it matters
This commit adds a safety check to a function that verifies unused data is zeroed. Before the change, if a caller passed an invalid 'used_bytes' value (for example, a negative number or one larger than 32), the function could read memory outside the intended 32-byte window or behave unexpectedly. The patch now rejects such invalid values immediately. The commit message calls it a routine cleanup ('chore') and does not claim it fixes a security vulnerability.
Treat as a hardening/defensive fix. Review callers of _check_padding_zero() to confirm used_bytes is derived safely and that InvalidFormatDefinition is handled appropriately in the Ethereum signing UI. No urgent incident response is indicated by the available materials.
Security signals we found
Bounds/length validation added to a parsing helper
Function operates on a fixed 32-byte memoryview
Commit labeled as routine chore with no changelog entry
No CVE, advisory, or vendor security statement supplied
Evidence from the diff
In core/src/apps/ethereum/clear_signing.py, the helper _check_padding_zero() validates that the leading (32 - used_bytes) bytes of a 32-byte memoryview are zero. The pre-patch code assumed 0 <= used_bytes <= 32 but never enforced it. Passing used_bytes > 32 would make the slice raw_data[:negative_number] reference bytes at the end of the view rather than the intended unused prefix, while used_bytes < 0 is not a meaningful length. The patch raises InvalidFormatDefinition for out-of-range values, preventing logic errors or misleading validation results during Ethereum clear-signing operations.
Changed components
core/src/apps/ethereum/clear_signing.pyEthereum clear-signing flow on Trezor devicesInspect captured patch +2 / −0
diff --git a/core/src/apps/ethereum/clear_signing.py b/core/src/apps/ethereum/clear_signing.py
index 9cbf1f8c..456bb5f2 100644
--- a/core/src/apps/ethereum/clear_signing.py
+++ b/core/src/apps/ethereum/clear_signing.py
@@ -90,6 +90,8 @@ def _check_padding_zero(
raw_data: memoryview, used_bytes: int, exc: type[ValueOverflow] = ValueOverflow
) -> None:
"""Sanity check to make sure unused data is zeroed out."""
+ if not 0 <= used_bytes <= 32:
+ raise InvalidFormatDefinition
if any(raw_data[: 32 - used_bytes]):
raise exc
Why this scored 47/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.