Guard capture allocations against impossible frame sizes #1033
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1035"
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?
Imported from fxceless/victory-fork. Originally posted by superboynick on 2026-11-25T16:57:41Z.
On a 4K-window machine, turning frame capture on killed the process before the first frame:
memory allocation of 7763201452000 bytes failedThe size came from unchecked multiplication of the presented width and height. This computes it with checked arithmetic, caps a single frame buffer at 512 MiB, and on failure warns once with the dimensions and the estimate, then disables capture and keeps presenting. Capture-off behaviour is untouched.
Tests. The decision is now a pure predicate over the estimated size, with cases that state the rule: 1080p and 4K fit, exactly at the ceiling fits, one byte over does not, a 64K square does not, and the multiplication that produced the 7.7 TB request overflows to
Noneinstead of wrapping.cargo test -p victory-gpu: 170 passed, 5 ignored.Verified on two machines: an RTX 5070 Ti at 1920x1080 (capture off: process alive, ~4170 log lines; capture on: alive, 12 PNGs written) and an RTX 3080 Ti at 3840x2160, where the old build died in the allocator and the new one writes capture frames.
Not claimed: this hardens the capture path rather than explaining why the harness reported those dimensions; the warning now prints width, height and estimate so the next occurrence is self-explanatory.
Imported from fxceless/victory-fork. Originally posted by superboynick on 2026-11-25T17:09:22Z.
Follow-up available in the same fork: a stacked change that adds
VICTORY_CAPTURE_AT(comma-separated seconds from the first present, writesframe-at-<t>.png) so captures line up across machines regardless of frame rate - https://github.com/superboynick/victory-fork/pull/1 . It depends on this guard, which is why it targets this branch rather thanmain. Happy to fold both into a single change if you prefer to review them together.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.