fix(core): render a full-turn sector as a full circle
What changed, and why it matters
This is a UI graphics bug fix in the Trezor hardware wallet firmware. When drawing a circular progress indicator or pie-chart-like shape spanning a full 360 degrees, the code mistakenly treated it as an empty slice and drew nothing. The patch detects a full-circle span before normalizing the angles and forces it to draw all eight segments plus the center pixel. There is no direct security vulnerability here; it is a rendering correctness fix.
No security action required. Treat as a normal UI correctness fix and include in regular firmware release testing.
Security signals we found
No memory safety, cryptographic, or authorization issues present in the diff
Change is confined to UI rendering logic
No input from untrusted sources is processed beyond existing angle parameters
No changelog entry suggests developer considered this a routine bug fix
Evidence from the diff
The fill_sector method in core/embed/rust/src/ui/shape/canvas/common.rs normalizes start and end angles into [0,360). For an exact full turn (e.g., 0 to 360), both endpoints collapse to the same value, so the octant-based loop interprets the sector as zero-width and skips drawing. The fix computes full_turn = end - start >= 360.0 before normalization, then pins start to 0 and end to 360 when true. Partial sectors and backward wrap-around cases are preserved, and infinite endpoints still hit the normalization assert rather than silently becoming a circle. The change is purely about drawing completeness for full-circle sectors.
Changed components
core/embed/rust/src/ui/shape/canvas/common.rsTrezor firmware UI canvas renderingInspect captured patch +7 / −0
### core/embed/rust/src/ui/shape/canvas/common.rs
@@ -600,9 +600,16 @@ pub trait Canvas: BasicCanvas {
return;
}
+ let full_turn = end - start >= 360.0;
+
start = (360.0 + start % 360.0) % 360.0;
end = (360.0 + end % 360.0) % 360.0;
+ if full_turn {
+ start = 0.0;
+ end = 360.0;
+ }
+
let alpha = 255;
let alpha_mul = |a: u8| -> u8 { ((u16::from(a) * u16::from(alpha)) / 255) as u8 };
Why this scored 19/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.