mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 17:11:23 +00:00
cellPad: fix potential out of bounds read and u32 warnings
This commit is contained in:
parent
656f971823
commit
9d88102520
@ -71,9 +71,9 @@ void pad_info::save(utils::serial& ar)
|
||||
sys_io_serialize(ar);
|
||||
}
|
||||
|
||||
extern void send_sys_io_connect_event(u32 index, u32 state);
|
||||
extern void send_sys_io_connect_event(usz index, u32 state);
|
||||
|
||||
void cellPad_NotifyStateChange(u32 index, u32 state)
|
||||
void cellPad_NotifyStateChange(usz index, u32 state)
|
||||
{
|
||||
auto info = g_fxo->try_get<pad_info>();
|
||||
|
||||
@ -84,7 +84,7 @@ void cellPad_NotifyStateChange(u32 index, u32 state)
|
||||
|
||||
std::lock_guard lock(pad::g_pad_mutex);
|
||||
|
||||
if (!info->max_connect)
|
||||
if (index >= info->get_max_connect())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -148,7 +148,7 @@ void cellPad_NotifyStateChange(u32 index, u32 state)
|
||||
}
|
||||
}
|
||||
|
||||
extern void pad_state_notify_state_change(u32 index, u32 state)
|
||||
extern void pad_state_notify_state_change(usz index, u32 state)
|
||||
{
|
||||
cellPad_NotifyStateChange(index, state);
|
||||
}
|
||||
@ -179,7 +179,7 @@ error_code cellPadInit(ppu_thread& ppu, u32 max_connect)
|
||||
|
||||
const auto& pads = handler->GetPads();
|
||||
|
||||
for (u32 i = 0; i < statuses.size(); ++i)
|
||||
for (usz i = 0; i < statuses.size(); ++i)
|
||||
{
|
||||
if (i >= config.get_max_connect())
|
||||
break;
|
||||
|
@ -36,7 +36,7 @@ extern void sys_io_serialize(utils::serial& ar)
|
||||
g_fxo->get<libio_sys_config>().save_or_load(ar);
|
||||
}
|
||||
|
||||
extern void cellPad_NotifyStateChange(u32 index, u32 state);
|
||||
extern void cellPad_NotifyStateChange(usz index, u32 state);
|
||||
|
||||
void config_event_entry(ppu_thread& ppu)
|
||||
{
|
||||
@ -101,7 +101,7 @@ std::unique_lock<shared_mutex> lock_lv2_mutex_alike(shared_mutex& mtx, ppu_threa
|
||||
return lock;
|
||||
}
|
||||
|
||||
extern void send_sys_io_connect_event(u32 index, u32 state)
|
||||
extern void send_sys_io_connect_event(usz index, u32 state)
|
||||
{
|
||||
auto& cfg = g_fxo->get<libio_sys_config>();
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
cfg_input g_cfg_input;
|
||||
|
||||
extern void pad_state_notify_state_change(u32 index, u32 state);
|
||||
extern void pad_state_notify_state_change(usz index, u32 state);
|
||||
|
||||
PadHandlerBase::PadHandlerBase(pad_handler type) : m_type(type)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user