Bound decoded screenshot pixels before mobile evidence preview #837

Closed
opened 2026-08-14 16:31:15 +00:00 by timmy · 0 comments
Owner

Problem

Mobile evidence accepts screenshots at or below 2 MB without decoding them. Highly compressed, very high-resolution images can therefore expand to unsafe memory use when previewed or edited, freezing or evicting the installed dashboard. Oversized byte payloads are resized, but decoded pixel count is currently unbounded.

Vertical slice

Decode every selected screenshot before preview, enforce a bounded decoded-pixel budget, downscale over-budget images while preserving filename/type/order/notes, and reject invalid dimensions truthfully. Keep existing 2 MB upload enforcement and stale-selection safety.

Acceptance tests

  • A sub-2 MB image above the decoded-pixel budget is downscaled before preview and durable serialization.
  • A normal image within both byte and pixel budgets is returned unchanged after validation.
  • Resizing targets both byte and pixel limits and preserves filename/type.
  • Zero/invalid dimensions and decode failures fail with actionable guidance; bitmap resources close.
  • Focused tests and full suite pass.

Evidence / non-duplication

frontend/issue-evidence-review.js currently returns immediately at line 17 when file.size <= MAX_BYTES, before createImageBitmap. Historical issue/title, release, PR, and recent commit review found only #495/#496 (byte-threshold screenshot optimization), not decoded-pixel limits.

## Problem Mobile evidence accepts screenshots at or below 2 MB without decoding them. Highly compressed, very high-resolution images can therefore expand to unsafe memory use when previewed or edited, freezing or evicting the installed dashboard. Oversized byte payloads are resized, but decoded pixel count is currently unbounded. ## Vertical slice Decode every selected screenshot before preview, enforce a bounded decoded-pixel budget, downscale over-budget images while preserving filename/type/order/notes, and reject invalid dimensions truthfully. Keep existing 2 MB upload enforcement and stale-selection safety. ## Acceptance tests - A sub-2 MB image above the decoded-pixel budget is downscaled before preview and durable serialization. - A normal image within both byte and pixel budgets is returned unchanged after validation. - Resizing targets both byte and pixel limits and preserves filename/type. - Zero/invalid dimensions and decode failures fail with actionable guidance; bitmap resources close. - Focused tests and full suite pass. ## Evidence / non-duplication `frontend/issue-evidence-review.js` currently returns immediately at line 17 when `file.size <= MAX_BYTES`, before `createImageBitmap`. Historical issue/title, release, PR, and recent commit review found only #495/#496 (byte-threshold screenshot optimization), not decoded-pixel limits.
timmy self-assigned this 2026-08-14 16:31:15 +00:00
timmy closed this issue 2026-08-14 16:37:56 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
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: stackchain/stackchain-dashboard#837
No description provided.