1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-04-25 13:57:45 +00:00

Prevent overflow when loading high resolution textures in certain code paths

With the release of Dawntrail, these are now being hit - for example loading the
expansion logo in Astra. These are now converted to usize everywhere so it
prevents this from happening.
This commit is contained in:
Joshua Goins 2024-06-26 23:45:50 -04:00
parent 6700d1f3ac
commit 39d7a5b703

View file

@ -120,7 +120,7 @@ impl Texture {
let mut offset = 0;
let mut dst_offset = 0;
for _ in 0..header.width * header.height {
for _ in 0..header.width as usize * header.height as usize {
let short: u16 = ((src[offset] as u16) << 8) | src[offset + 1] as u16;
let src_b = short & 0xF;
@ -146,7 +146,7 @@ impl Texture {
let mut offset = 0;
for _ in 0..header.width * header.height * header.depth {
for _ in 0..header.width as usize * header.height as usize * header.depth as usize {
let src_b = src[offset];
let src_g = src[offset + 1];
let src_r = src[offset + 2];