aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzedarider <ymherklotz@gmail.com>2016-10-27 14:37:23 +0100
committerzedarider <ymherklotz@gmail.com>2016-10-27 14:37:23 +0100
commit58e3d34252d003f748b73d55b81155a5f76c0a54 (patch)
tree75d27ce72f9fc5f769e71a11c77d44d8f6ad6c97
parenta09d256996261c481fd7fab1bd11865a2144bbd7 (diff)
parenta063f91a1b1d09a6eb41cc025810f72b2b2df948 (diff)
downloadMipsCPU-58e3d34252d003f748b73d55b81155a5f76c0a54.tar.gz
MipsCPU-58e3d34252d003f748b73d55b81155a5f76c0a54.zip
Merge branch 'master' of https://github.com/m8pple/arch2-2016-cw
-rw-r--r--src/shared/mips_mem_ram.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/shared/mips_mem_ram.cpp b/src/shared/mips_mem_ram.cpp
index 0a01b5b..179c8fd 100644
--- a/src/shared/mips_mem_ram.cpp
+++ b/src/shared/mips_mem_ram.cpp
@@ -18,8 +18,8 @@ struct mips_mem_provider
extern "C" mips_mem_h mips_mem_create_ram(
uint32_t cbMem //!< Total number of bytes of ram
){
- if(cbMem>0x10000000){
- return 0; // No more than 256MB of RAM
+ if(cbMem>0x20000000){
+ return 0; // No more than 512MB of RAM
}
uint8_t *data=(uint8_t*)malloc(cbMem);
@@ -57,7 +57,7 @@ static mips_error mips_mem_read_write(
if(0 != (address % length) ){
return mips_ExceptionInvalidAlignment;
}
- if((address+length) > mem->length){ // A subtle bug here, maybe?
+ if(((address+length) > mem->length) || (address > (UINT32_MAX - length))){ // A subtle bug here, maybe?
return mips_ExceptionInvalidAddress;
}