mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-26 06:07: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:
parent
6700d1f3ac
commit
39d7a5b703
1 changed files with 2 additions and 2 deletions
|
@ -120,7 +120,7 @@ impl Texture {
|
||||||
let mut offset = 0;
|
let mut offset = 0;
|
||||||
let mut dst_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 short: u16 = ((src[offset] as u16) << 8) | src[offset + 1] as u16;
|
||||||
|
|
||||||
let src_b = short & 0xF;
|
let src_b = short & 0xF;
|
||||||
|
@ -146,7 +146,7 @@ impl Texture {
|
||||||
|
|
||||||
let mut offset = 0;
|
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_b = src[offset];
|
||||||
let src_g = src[offset + 1];
|
let src_g = src[offset + 1];
|
||||||
let src_r = src[offset + 2];
|
let src_r = src[offset + 2];
|
||||||
|
|
Loading…
Add table
Reference in a new issue