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

Merged
9hvn9yt2vk-netizen merged 1 commit from upstream-pr/15 into main 2026-11-23 23:28:40 +00:00
9hvn9yt2vk-netizen commented 2026-11-23 23:02:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 9hvn9yt2vk-netizen on 2026-11-23T23:02:32Z.


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).

<!-- greyfinch-sync:Marvisak/VIctory:issue:6570630604 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/15). Originally posted by [9hvn9yt2vk-netizen](https://github.com/9hvn9yt2vk-netizen) on 2026-11-23T23:02:32Z. --- 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).
upstream-sync closed this pull request 2026-11-24 06:50:55 +00:00
9hvn9yt2vk-netizen commented 2026-11-24 06:54:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 9hvn9yt2vk-netizen on 2026-11-23T23:03:08Z.


loooook at thisssssss

<!-- greyfinch-sync:Marvisak/VIctory:comment:7116494627 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/15#issuecomment-7116494627). Originally posted by [9hvn9yt2vk-netizen](https://github.com/9hvn9yt2vk-netizen) on 2026-11-23T23:03:08Z. --- loooook at thisssssss
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!15
No description provided.