mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
Merge pull request #860 from devmapal/master
Fixes segfault described in #794
This commit is contained in:
commit
7904d87ddd
1 changed files with 15 additions and 0 deletions
|
@ -26,6 +26,16 @@ s32 sys_semaphore_create(vm::ptr<u32> sem, vm::ptr<sys_semaphore_attribute> attr
|
|||
sys_semaphore.Warning("sys_semaphore_create(sem_addr=0x%x, attr_addr=0x%x, initial_count=%d, max_count=%d)",
|
||||
sem.addr(), attr.addr(), initial_count, max_count);
|
||||
|
||||
if (sem.addr() == NULL) {
|
||||
sys_semaphore.Error("sys_semaphore_create(): invalid memory access (sem_addr=0x%x)", sem.addr());
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
if (attr.addr() == NULL) {
|
||||
sys_semaphore.Error("sys_semaphore_create(): An invalid argument value is specified (attr_addr=0x%x)", attr.addr());
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if (max_count <= 0 || initial_count > max_count || initial_count < 0)
|
||||
{
|
||||
sys_semaphore.Error("sys_semaphore_create(): invalid parameters (initial_count=%d, max_count=%d)", initial_count, max_count);
|
||||
|
@ -204,6 +214,11 @@ s32 sys_semaphore_get_value(u32 sem_id, vm::ptr<s32> count)
|
|||
{
|
||||
sys_semaphore.Log("sys_semaphore_get_value(sem_id=%d, count_addr=0x%x)", sem_id, count.addr());
|
||||
|
||||
if (count.addr() == NULL) {
|
||||
sys_semaphore.Error("sys_semaphore_get_value(): invalid memory access (count=0x%x)", count.addr());
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
Semaphore* sem;
|
||||
if (!Emu.GetIdManager().GetIDData(sem_id, sem))
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue