AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 31 Bitcoin

chore(core/embed): assert that bitblt probe lengths cannot overflow

Public commit record

What the developer wrote

Authored by tychovrahe

100/100 · Strong
chore(core/embed): assert that bitblt probe lengths cannot overflow

CHECK_BB_DST and CHECK_BB_SRC multiply a stride by a height into a `size_t`
to get the length they probe. That is safe today only because every dimension
in `gfx_bitblt_t` is 16-bit: an unsigned product needs as many bits as its
operands have together, so 16 + 16 fits a 32-bit `size_t` exactly, with a
maximum product of 4294836225.

The relationship was implicit. Widening any of those fields would turn the
product into a wrapped, much smaller value, and the macros would then probe a
fraction of the memory the blit goes on to touch - the probe would start
approving what it is meant to reject. State the requirement as a static
assert so that change breaks the build instead.

No behavioural change.

[no changelog]

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This is a hardening change, not a fix for an active bug. It adds a compile-time safety check to ensure that future changes to graphics dimensions cannot cause a memory-bounds check to silently undercount how much memory a drawing operation will touch. As written today the code is safe; the patch prevents a future, potentially dangerous code change from being accepted without notice.

Recommended action

Treat as a low-risk hardening commit. No immediate patch or incident response is required. Reviewers should verify that the static assertion correctly captures the invariant and that any future widening of gfx_bitblt_t dimensions is accompanied by a checked multiply.

Security signals we found

01

Defensive hardening of syscall verifier macros

02

Prevents potential integer overflow in memory-probe length calculation

03

Compile-time assertion to catch future type changes

04

No runtime behavior change in current configuration

Risk score

Why this scored 31/100

Our methodology →
Potential impact 6/30
Exploitability 4/25
Stealth signal 5/15
Affected reach 5/15
Confidence 7/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.