texture: refuse extents past 16384 texels instead of overflowing #15

Manually merged
github merged 1 commit from gh-pr/15/head into gh-pr/15/base 2026-11-26 03:46:36 +00:00
Owner

@⁠9hvn9yt2vk-netizen on GitHub · 2026-11-23 23:02 UTC · original
9hvn9yt2vk-netizen:fix-texture-extents → main · +31 −3 · 1 files · 1 commits · merged 2026-11-23 23:28 UTC

Layout::new checked that width, height and depth are non-zero but not that they are bounded, so values a title passes unchecked (up to u32::MAX) overflowed the size arithmetic: offset * depth in the linear layout, slice_size * slices and the per-mip sizes in the tiled one, and a u32 next_multiple_of in Layout::tiled. Debug builds panicked; release builds wrapped silently and returned a wrong size.

Refuse anything past 16384 texels per side, the most a GFX10 image descriptor holds, so no texture the GPU can use is affected.

Found with a random-input harness (four distinct overflow sites, none left after this change).

**@⁠9hvn9yt2vk-netizen** on GitHub · 2026-11-23 23:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/15) `9hvn9yt2vk-netizen:fix-texture-extents` → `main` · +31 −3 · 1 files · 1 commits · merged 2026-11-23 23:28 UTC Layout::new checked that width, height and depth are non-zero but not that they are bounded, so values a title passes unchecked (up to u32::MAX) overflowed the size arithmetic: `offset * depth` in the linear layout, `slice_size * slices` and the per-mip sizes in the tiled one, and a u32 next_multiple_of in Layout::tiled. Debug builds panicked; release builds wrapped silently and returned a wrong size. Refuse anything past 16384 texels per side, the most a GFX10 image descriptor holds, so no texture the GPU can use is affected. Found with a random-input harness (four distinct overflow sites, none left after this change).
Layout::new checked that width, height and depth are non-zero but not that
they are bounded, so values a title passes unchecked (up to u32::MAX)
overflowed the size arithmetic: `offset * depth` in the linear layout,
`slice_size * slices` and the per-mip sizes in the tiled one, and a u32
next_multiple_of in Layout::tiled. Debug builds panicked; release builds
wrapped silently and returned a wrong size.

Refuse anything past 16384 texels per side, the most a GFX10 image
descriptor holds, so no texture the GPU can use is affected.

Found with a random-input harness (four distinct overflow sites, none left
after this change).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:46:34 +00:00
github manually merged commit e6a2c5471a into gh-pr/15/base 2026-11-26 03:46:36 +00:00
Author
Owner

@⁠9hvn9yt2vk-netizen on GitHub · 2026-11-23 23:03 UTC · original

loooook at thisssssss

**@⁠9hvn9yt2vk-netizen** on GitHub · 2026-11-23 23:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/15#issuecomment-7116494627) loooook at thisssssss
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
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
github/Marvisak--VIctory!15
No description provided.