From b02d23b990fb8c0848c2787cacd7eb459e094be4 Mon Sep 17 00:00:00 2001 From: Vadim Grigoruk Date: Fri, 13 Oct 2017 09:51:35 +0300 Subject: [PATCH 1/3] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d4f7f71..17b934e 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Documentation is available in the [wiki](https://github.com/nesbox/tic.computer/ Thanks! -# Building instructions +# Build instructions ## Windows ### with Visual Studio 2015 @@ -24,6 +24,10 @@ git clone https://github.com/nesbox/TIC-80 - open `TIC-80\build\windows\tic\tic.sln` and build - enjoy :) +### with MinGW32 +follow the instructions in the tutorial https://matheuslessarodrigues.github.io/tic80-build-tutorial/ +made by [@matheuslessarodrigues](https://github.com/matheuslessarodrigues) + ## Linux run the following commands in the Terminal ``` From cd101d429af1d85044dc1e352a37d954415a5764 Mon Sep 17 00:00:00 2001 From: Vadim Grigoruk Date: Fri, 13 Oct 2017 11:21:21 +0300 Subject: [PATCH 2/3] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 17b934e..6be9e4b 100644 --- a/README.md +++ b/README.md @@ -36,3 +36,6 @@ git clone https://github.com/nesbox/TIC-80 cd TIC-80 make linux32 (or linux64/arm depending on your system) ``` + +## iOS / tvOS +You can find iOS/tvOS version here https://github.com/CliffsDover/TIC-80 From 48f61d7b8076ab5e023079d72335a36420ddadc5 Mon Sep 17 00:00:00 2001 From: death Date: Tue, 17 Oct 2017 07:00:45 +0300 Subject: [PATCH 3/3] better bounds checking for memcpy, memset --- src/jsapi.c | 7 +++---- src/luaapi.c | 11 +++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/jsapi.c b/src/jsapi.c index b090deb..efd1ecf 100644 --- a/src/jsapi.c +++ b/src/jsapi.c @@ -466,10 +466,9 @@ static duk_ret_t duk_memcpy(duk_context* duk) s32 dest = duk_to_int(duk, 0); s32 src = duk_to_int(duk, 1); s32 size = duk_to_int(duk, 2); - s32 dstBound = sizeof(tic_ram) - size; - s32 srcBound = sizeof(tic_mem) - size; + s32 bound = sizeof(tic_ram) - size; - if(size > 0 && dest < dstBound && src < srcBound) + if(size >= 0 && size <= sizeof(tic_ram) && dest >= 0 && src >= 0 && dest <= bound && src <= bound) { u8* base = (u8*)&getDukMachine(duk)->memory; memcpy(base + dest, base + src, size); @@ -485,7 +484,7 @@ static duk_ret_t duk_memset(duk_context* duk) s32 size = duk_to_int(duk, 2); s32 bound = sizeof(tic_ram) - size; - if(size > 0 && dest < bound) + if(size >= 0 && size <= sizeof(tic_ram) && dest >= 0 && dest <= bound) { u8* base = (u8*)&getDukMachine(duk)->memory; memset(base + dest, value, size); diff --git a/src/luaapi.c b/src/luaapi.c index c005e57..4955b03 100644 --- a/src/luaapi.c +++ b/src/luaapi.c @@ -759,14 +759,13 @@ static s32 lua_memcpy(lua_State* lua) s32 dest = getLuaNumber(lua, 1); s32 src = getLuaNumber(lua, 2); s32 size = getLuaNumber(lua, 3); - s32 dstBound = sizeof(tic_ram) - size; - s32 srcBound = sizeof(tic_mem) - size; + s32 bound = sizeof(tic_ram) - size; - if(dest < dstBound && src < srcBound) + if(size >= 0 && size <= sizeof(tic_ram) && dest >= 0 && src >= 0 && dest <= bound && src <= bound) { u8* base = (u8*)&getLuaMachine(lua)->memory; memcpy(base + dest, base + src, size); - return 0; + return 0; } } @@ -786,11 +785,11 @@ static s32 lua_memset(lua_State* lua) s32 size = getLuaNumber(lua, 3); s32 bound = sizeof(tic_ram) - size; - if(dest < bound) + if(size >= 0 && size <= sizeof(tic_ram) && dest >= 0 && dest <= bound) { u8* base = (u8*)&getLuaMachine(lua)->memory; memset(base + dest, value, size); - return 0; + return 0; } }