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

Use integer progress fractions

Public commit record

What the developer wrote

Authored by Marko Bencun

58/100 · Thin
Use integer progress fractions

Add an integer `set_fraction()` progress path through the HAL and UI layers,
and switch the live Bitcoin-signing and Bluetooth-upgrade progress updates to
use it.

The progress bar ultimately renders whole pixels, so the C progress component
now stores the filled pixel width directly and computes it with integer math.
This keeps the visible behavior intact while removing the Rust-side soft-float
`f32` arithmetic path that was only used for progress updates.

In the final firmware image this drops the live
`compiler_builtins::float::{add,div,mul}::<f32>` helpers together with the
associated `__aeabi_fadd`, `__aeabi_fdiv`, and `__aeabi_fmul` wrappers.

Savings: 1352 bytes
✓ Descriptive subject✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit replaces floating-point progress calculations with integer math to save firmware space. It removes the use of f32 arithmetic for progress bars in Bitcoin transaction signing and Bluetooth firmware upgrades. There is no direct security vulnerability in the change itself; it is a code-quality and size-reduction refactor. However, it introduces new integer arithmetic paths that must keep numerator/denominator assumptions valid to avoid incorrect progress display.

Recommended action

No immediate action required. Reviewers should verify that all future call sites of `set_fraction` enforce `denominator > 0` and `numerator <= denominator`, and that the 64-bit intermediate in `progress.c` remains sufficient for expected numerator ranges. Consider adding unit tests for edge cases (zero denominator, numerator > denominator, large values).

Security signals we found

01

Removal of floating-point arithmetic reduces attack surface related to soft-float emulation bugs

02

New integer fraction API introduces denominator-non-zero and numerator-bound assumptions

03

Call sites use checked arithmetic to prevent overflow in progress computation

04

C-side progress width uses 64-bit intermediate to avoid overflow when multiplying SCREEN_WIDTH * numerator

Risk score

Why this scored 19/100

Our methodology →
Potential impact 2/30
Exploitability 1/25
Stealth signal 1/15
Affected reach 3/15
Confidence 8/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.