1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2025-03-15 04:21:01 +00:00

cellSaveData: Fix check 58, implement checks 77 and 76

This commit is contained in:
Eladash 2023-08-07 17:08:19 +03:00 committed by Elad Ashkenazi
parent d694600146
commit 8e75e940dd

@ -1547,22 +1547,35 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
return {CELL_SAVEDATA_ERROR_PARAM, "57 (attribute=0x%x)", statSet->setParam->attribute};
}
if (g_ps3_process_info.sdk_ver > 0x36FFFF)
{
// In firmware 3.70 or higher parental_level was changed to reserved2 and has to zeroes
if (statSet->setParam->parental_level)
{
// ****** sysutil savedata parameter error : 58 ******
return {CELL_SAVEDATA_ERROR_PARAM, "58 (sdk_ver=0x%x, parental_level=%d)", g_ps3_process_info.sdk_ver, statSet->setParam->parental_level};
}
}
else
{
if (statSet->setParam->parental_level > 11)
{
// ****** sysutil savedata parameter error : 58 ******
return {CELL_SAVEDATA_ERROR_PARAM, "58 (sdk_ver=0x%x, parental_level=%d)", g_ps3_process_info.sdk_ver, statSet->setParam->parental_level};
}
// Note: in firmware 3.70 or higher parental_level was changed to reserved2
for (usz index = 0;; index++)
{
// Convert to pointer to avoid UB when accessing out of range
const u8 c = (+statSet->setParam->listParam)[index];
if (c == 0 || index >= (g_ps3_process_info.sdk_ver > 0x36FFFF ? std::size(statSet->setParam->listParam) - 1 : std::size(statSet->setParam->listParam)))
{
if (c)
{
// ****** sysutil savedata parameter error : 76 ******
return {CELL_SAVEDATA_ERROR_PARAM, "76 (listParam=0x%016x)", std::bit_cast<be_t<u64>>(statSet->setParam->listParam)};
}
break;
}
if ((c < 'A' || c > 'Z') && (c < '0' || c > '9') && c != '-' && c != '_')
{
// ****** sysutil savedata parameter error : 77 ******
return {CELL_SAVEDATA_ERROR_PARAM, "77 (listParam=0x%016x)", std::bit_cast<be_t<u64>>(statSet->setParam->listParam)};
}
}
for (u8 resv : statSet->setParam->reserved)