From 7fda07eb5b263c3a047106e5c787da62d7b78058 Mon Sep 17 00:00:00 2001 From: Eladash Date: Sat, 10 Aug 2019 13:03:14 +0300 Subject: [PATCH] rsx: UB fix (signed vs unsigned mismatch) --- rpcs3/Emu/RSX/rsx_methods.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index 5d0f589a18..c859ab437b 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -941,7 +941,7 @@ namespace rsx } const u32 in_offset = in_x * in_bpp + in_pitch * in_y; - const s32 out_offset = out_x * out_bpp + out_pitch * out_y; + const u32 out_offset = out_x * out_bpp + out_pitch * out_y; const u32 src_address = get_address(src_offset, src_dma); const u32 dst_address = get_address(dst_offset, dst_dma); @@ -1022,15 +1022,15 @@ namespace rsx if (scale_y < 0 || scale_x < 0) { - const auto packed_pitch = in_w * in_bpp; + const u32 packed_pitch = in_w * in_bpp; temp1.resize(packed_pitch * in_h); - const s32 stride_y = (scale_y < 0 ? -1 : 1) * in_pitch; + const s32 stride_y = (scale_y < 0 ? -1 : 1) * (s32)in_pitch; for (u32 y = 0; y < in_h; ++y) { u8 *dst = temp1.data() + (packed_pitch * y); - u8 *src = pixels_src + (y * stride_y); + u8 *src = pixels_src + ((s32)y * stride_y); if (scale_x < 0) {