fix(vk): validate capture dimensions before allocating readbacks #1551
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1551
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/capture-dimension-contract"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Screenshot dimensions are converted with
atoiand narrowed before validation. Invalid text becomes zero, negative dimensions become huge unsigned values, and the RGBA byte expression can wrap. Requests can reach Vulkan before rejection, and an image that fits the device can still exceed the existing PNG encoder's single-IDAT limit.Parse positive decimal dimensions without overflow, then validate device, readback and encoder bounds before any screenshot allocation. Reject unsupported requests once for that process, with a diagnostic; keep valid requested sizes and the1280x720 default. Window presentation continues, and headless mode retains its offscreen policy without producing a capture for an invalid request. Signed, whitespace-containing and partially numeric values are intentionally rejected rather than accepted as a prefix. This adds no arbitrary memory budget and does not guarantee that an otherwise valid request can be allocated.
Validation at
c35bd37on main7d1562d:Resource lifetime/readiness remains in #1472. A private CPU composition passes both production-code suites after its sliced setup fixture includes the real dimension guard and initialized device limits; validation is not stubbed out. This PR does not import1472's allocation changes. See
docs/capture-dimensions.md, including the PNG format bound and integration note. No game data, captures, generated game code or binaries are included. Three exact-head fork workflows follow.Current-head validation
Current head
e20c42c, based on mainff69134. Earlier local/runtime results describe their recorded source hashes.Integrated with main screenshot readiness/slot ownership/flash sampling. The sliced resource fixture includes the real dimension guard and initialized device limits. Dimension/resource/slot suites pass, seven dimension mutations remain causal, and Linux GCC/ASan/UBSan pass. The fixture also uses the production CRT compatibility definition under native Windows clang; warnings remain errors. Earlier native evidence stays attached to its recorded hash.
Fork runs are separate from upstream Actions approval; no maintainer approval gate is bypassed.