GRI-2014: keep the reserved display number below x11rb's TCP-port overflow #195

Merged
vivy merged 1 commit from fix/GRI-2014-pptx-display-overflow into dev 2026-11-14 14:53:34 +00:00
Member

What

Forge #189's remaining step was a real end-to-end .pptx upload check on dev
(no fake tools) with an auto-timed deck whose slides run longer than the 10s
idle_end_seconds default, and a click-advance deck. Both decks hit the
fallback path intermittently instead of rendering a video, reproducing the
"pre-existing X/x11rb display-parsing issue" flagged earlier on that forge
issue as a follow-up.

Root cause: reserve_display() in pptx_video.rs picks a virtual display
number from 100..65000. pptx_video_presenter's X11 client
(x11rb-protocol) always computes a localhost TCP fallback connect target
as 6000 + display in u16 arithmetic — even though Xvfb here is started
with -nolisten tcp and is only ever reached over its Unix socket. A display
at or above 65536 - 6000 = 59536 overflows that addition and panics in a
debug build, so roughly 8% of renders crashed the presenter and fell back to
slide images even though the real render path was otherwise healthy.

Fix: cap the reserved display range at 100..=59535.

Verification

  • cargo test -p server --lib pptx_video: 24/24 (new test
    reserved_displays_stay_below_the_x11rb_tcp_port_overflow asserts 200 draws
    stay in bounds).
  • cargo fmt -- --check, cargo clippy -p server --lib --bins --tests -- -D warnings: clean.
  • ./scripts/local-gates.sh --rust-only: every gate passed.
  • Manually re-ran the real end-to-end upload (real soffice/Xvfb/ffmpeg,
    no fakes) for both decks named above after the fix; both produced one
    video item.
## What Forge #189's remaining step was a real end-to-end `.pptx` upload check on `dev` (no fake tools) with an auto-timed deck whose slides run longer than the 10s `idle_end_seconds` default, and a click-advance deck. Both decks hit the fallback path intermittently instead of rendering a video, reproducing the "pre-existing X/x11rb display-parsing issue" flagged earlier on that forge issue as a follow-up. Root cause: `reserve_display()` in `pptx_video.rs` picks a virtual display number from `100..65000`. `pptx_video_presenter`'s X11 client (`x11rb-protocol`) always computes a `localhost` TCP fallback connect target as `6000 + display` in `u16` arithmetic — even though `Xvfb` here is started with `-nolisten tcp` and is only ever reached over its Unix socket. A display at or above `65536 - 6000 = 59536` overflows that addition and panics in a debug build, so roughly 8% of renders crashed the presenter and fell back to slide images even though the real render path was otherwise healthy. Fix: cap the reserved display range at `100..=59535`. ## Verification - `cargo test -p server --lib pptx_video`: 24/24 (new test `reserved_displays_stay_below_the_x11rb_tcp_port_overflow` asserts 200 draws stay in bounds). - `cargo fmt -- --check`, `cargo clippy -p server --lib --bins --tests -- -D warnings`: clean. - `./scripts/local-gates.sh --rust-only`: every gate passed. - Manually re-ran the real end-to-end upload (real `soffice`/`Xvfb`/`ffmpeg`, no fakes) for both decks named above after the fix; both produced one `video` item.
GRI-2014: keep the reserved display number below x11rb's TCP-port overflow
Some checks failed
CI / the pre-push hook (pull_request) Successful in 13s
CI / cargo fmt (pull_request) Successful in 14s
CI / cargo deny (pull_request) Successful in 58s
CI / cargo clippy (pull_request) Successful in 2m13s
CI / cargo deny advisories (pull_request) Failing after 1m43s
CI / cargo test (pull_request) Successful in 3m40s
CI / repository boundary (pull_request) Successful in 1m6s
CI / frontend-web (pull_request) Successful in 2m8s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 11s
4a45b0c18c
vivy merged commit cb1377c604 into dev 2026-11-14 14:53:34 +00:00
vivy deleted branch fix/GRI-2014-pptx-display-overflow 2026-11-14 14:53:35 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage!195
No description provided.