mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-15 11:18:36 +12:00
rsx: Prevent out-of-bounds writes when resolving shader input textures
- The target area can also have padding!
This commit is contained in:
parent
1c439f6198
commit
e02e27b2b3
1 changed files with 9 additions and 2 deletions
|
@ -1280,10 +1280,17 @@ namespace rsx
|
||||||
if (LIKELY(this_address >= texaddr))
|
if (LIKELY(this_address >= texaddr))
|
||||||
{
|
{
|
||||||
const auto offset = this_address - texaddr;
|
const auto offset = this_address - texaddr;
|
||||||
info.src_x = 0;
|
|
||||||
info.src_y = 0;
|
|
||||||
info.dst_y = (offset / required_pitch);
|
info.dst_y = (offset / required_pitch);
|
||||||
info.dst_x = (offset % required_pitch) / required_bpp;
|
info.dst_x = (offset % required_pitch) / required_bpp;
|
||||||
|
|
||||||
|
if (UNLIKELY(info.dst_x >= required_width || info.dst_y >= required_height))
|
||||||
|
{
|
||||||
|
// Out of bounds
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
info.src_x = 0;
|
||||||
|
info.src_y = 0;
|
||||||
info.width = std::min<u32>(normalized_surface_width, required_width - info.dst_x);
|
info.width = std::min<u32>(normalized_surface_width, required_width - info.dst_x);
|
||||||
info.height = std::min<u32>(normalized_surface_height, required_height - info.dst_y);
|
info.height = std::min<u32>(normalized_surface_height, required_height - info.dst_y);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue