diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-02-19 16:32:39 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-02-19 16:32:39 -0800 |
commit | 634c9b963c109c772f3ba913d4abd328093059bc (patch) | |
tree | d0059f0b94ccf5a4f33ad933e9f9b2cb847a8ad5 /tests/runner.py | |
parent | 6dfcace48a061dd93643a4da4647591d73bdcc31 (diff) |
handle malloc(0) and free(0) in corruption checker
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-x | tests/runner.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index a2d75cfe..f0340cd0 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -7214,6 +7214,42 @@ def process(filename): for corrupt in [1]: self.do_run(src.replace('CORRUPT', str(corrupt)), 'Heap corruption detected!' if corrupt else 'All ok, 4209') + def test_corruption_2(self): + if Settings.ASM_JS: return self.skip('cannot use corruption checks in asm') + if Settings.USE_TYPED_ARRAYS != 2: return self.skip('needs ta2 for actual test') + + Settings.SAFE_HEAP = 1 + Settings.CORRUPTION_CHECK = 1 + + # test for free(0), malloc(0), etc. + src = r''' + #include <iostream> + #include <fstream> + #include <stdlib.h> + #include <stdio.h> + + void bye() { + printf("all ok\n"); + } + + int main() { + atexit(bye); + + std::string testPath = "/Script/WA-KA.txt"; + std::fstream str(testPath.c_str(), std::ios::in | std::ios::binary); + + if (str.is_open()) + { + std::cout << "open!" << std::endl; + } else { + std::cout << "missing!" << std::endl; + } + + return 1; + } + ''' + self.do_run(src, 'missing!\nall ok\n') + ### Integration tests def test_ccall(self): |