Merge pull request #5790 from sum2012/scedmac

Further illegal size check in sceDmacMemcpy
This commit is contained in:
Henrik Rydgård 2014-04-03 17:16:39 +02:00
commit 19000c7a37
2 changed files with 9 additions and 4 deletions

View File

@ -16,6 +16,7 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "Common/ChunkFile.h"
#include "Core/HLE/sceDmac.h"
#include "Core/CoreTiming.h"
#include "Core/MemMap.h"
#include "Core/Reporting.h"
@ -75,9 +76,9 @@ u32 sceDmacMemcpy(u32 dst, u32 src, u32 size) {
ERROR_LOG(HLE, "sceDmacMemcpy(dest=%08x, src=%08x, size=%i): invalid address", dst, src, size);
return SCE_KERNEL_ERROR_INVALID_POINTER;
}
if (dst + size >= 0x80000000 || src + size >= 0x80000000 || size == 0xFFFFFFFF) {
if (dst + size >= 0x80000000 || src + size >= 0x80000000 || size >= 0x80000000) {
ERROR_LOG(HLE, "sceDmacMemcpy(dest=%08x, src=%08x, size=%i): illegal size", dst, src, size);
return 0x80000023;
return SCE_ERROR_PRIV_REQUIRED;
}
if (dmacMemcpyDeadline > CoreTiming::GetTicks()) {
@ -100,9 +101,9 @@ u32 sceDmacTryMemcpy(u32 dst, u32 src, u32 size) {
ERROR_LOG(HLE, "sceDmacTryMemcpy(dest=%08x, src=%08x, size=%i): invalid address", dst, src, size);
return SCE_KERNEL_ERROR_INVALID_POINTER;
}
if (dst + size >= 0x80000000 || src + size >= 0x80000000 || size == 0xFFFFFFFF) {
if (dst + size >= 0x80000000 || src + size >= 0x80000000 || size >= 0x80000000) {
ERROR_LOG(HLE, "sceDmacTryMemcpy(dest=%08x, src=%08x, size=%i): illegal size", dst, src, size);
return 0x80000023;
return SCE_ERROR_PRIV_REQUIRED;
}
if (dmacMemcpyDeadline > CoreTiming::GetTicks()) {

View File

@ -19,6 +19,10 @@
class PointerWrap;
enum {
SCE_ERROR_PRIV_REQUIRED = 0x80000023,
};
void __DmacInit();
void __DmacDoState(PointerWrap &p);