GRI-2014: cap the slide-xml read in longest_slide_advance_seconds #194

Merged
vivy merged 1 commit from fix/GRI-2014-pptx-slide-xml-read-cap into dev 2026-11-14 14:22:19 +00:00
Member

Follow-up from Vivy's non-blocking review note on PR #193 (forge #189): longest_slide_advance_seconds called read_to_string on a ppt/slides/slideN.xml zip entry with no size limit, so a crafted .pptx upload could decompress an arbitrarily large entry straight into memory (a zip bomb on this upload path).

Change

Cap the read at 8 MiB (a real slide part is a few KB). Past the cap, the file is treated the same as any other unreadable .pptx — longest_slide_advance_seconds returns Err(()), so effective_idle_after falls back to the full render_timeout_seconds (safe: slower, never truncates).

Tests

New unit test effective_idle_after_falls_back_to_the_render_timeout_when_a_slide_entry_is_oversized, writing a real zip with a >8 MiB slide entry and asserting the render-timeout fallback. cargo test -p server --lib pptx_video: 23/23 green. fmt/clippy -D warnings clean. ./scripts/local-gates.sh --rust-only: every gate passed.

Follow-up from Vivy's non-blocking review note on PR #193 (forge #189): `longest_slide_advance_seconds` called `read_to_string` on a `ppt/slides/slideN.xml` zip entry with no size limit, so a crafted `.pptx` upload could decompress an arbitrarily large entry straight into memory (a zip bomb on this upload path). ## Change Cap the read at 8 MiB (a real slide part is a few KB). Past the cap, the file is treated the same as any other unreadable `.pptx` — `longest_slide_advance_seconds` returns `Err(())`, so `effective_idle_after` falls back to the full `render_timeout_seconds` (safe: slower, never truncates). ## Tests New unit test `effective_idle_after_falls_back_to_the_render_timeout_when_a_slide_entry_is_oversized`, writing a real zip with a >8 MiB slide entry and asserting the render-timeout fallback. `cargo test -p server --lib pptx_video`: 23/23 green. `fmt`/`clippy -D warnings` clean. `./scripts/local-gates.sh --rust-only`: every gate passed.
GRI-2014: cap the slide-xml read in longest_slide_advance_seconds
Some checks failed
CI / the pre-push hook (pull_request) Successful in 42s
CI / cargo fmt (pull_request) Successful in 48s
CI / cargo clippy (pull_request) Successful in 2m22s
CI / cargo deny (pull_request) Successful in 2m26s
CI / cargo deny advisories (pull_request) Failing after 2m36s
CI / repository boundary (pull_request) Successful in 1m9s
CI / frontend-web (pull_request) Successful in 2m8s
CI / cargo test (pull_request) Successful in 4m19s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 24s
e54ac1b811
Review follow-up on PR #193 (Vivy, non-blocking): read_to_string on a
ppt/slides/slideN.xml zip entry had no size limit, so a crafted .pptx
upload could decompress an arbitrarily large entry into memory. Bound
it to 8 MiB; past that the file is treated as unreadable, same as any
other corrupt .pptx, falling back to render_timeout_seconds.
vivy merged commit a20cd7030d into dev 2026-11-14 14:22:19 +00:00
vivy deleted branch fix/GRI-2014-pptx-slide-xml-read-cap 2026-11-14 14:22:19 +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!194
No description provided.