Skip to content

Commit 4baf35f

Browse files
committed
Add combo test
1 parent 595bbe6 commit 4baf35f

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

test/test_other.py

+22
Original file line numberDiff line numberDiff line change
@@ -12226,6 +12226,28 @@ def test_asan_strncpy(self):
1222612226
# https://github.com/emscripten-core/emscripten/issues/14618
1222712227
self.do_runf('other/test_asan_strncpy.c', emcc_args=['-fsanitize=address'])
1222812228

12229+
@parameterized({
12230+
'asan': ['AddressSanitizer: null-pointer-dereference on address 0x00000000', '-fsanitize=address'],
12231+
'safe_heap': ['Aborted(segmentation fault storing 4 bytes at address 0)', '-sSAFE_HEAP'],
12232+
})
12233+
@parameterized({
12234+
'': [],
12235+
'memgrowth': ['-sALLOW_MEMORY_GROWTH'],
12236+
})
12237+
@parameterized({
12238+
'': [],
12239+
'bigendian': ['-sSUPPORT_BIG_ENDIAN'],
12240+
})
12241+
def test_null_deref_via_js(self, expected_output, *args):
12242+
# Multiple JS transforms look for pattern like `HEAPxx[...]` and transform it.
12243+
# This test ensures that one of the transforms doesn't produce a pattern that
12244+
# another pass can't find anymore, that is that features can work in conjunction.
12245+
self.do_runf(
12246+
'other/test_null_deref_via_js.c',
12247+
emcc_args=args,
12248+
assert_returncode=NON_ZERO,
12249+
expected_output=[expected_output])
12250+
1222912251
@node_pthreads
1223012252
def test_proxy_to_pthread_stack(self):
1223112253
# Check that the proxied main gets run with STACK_SIZE setting and not

tools/link.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -2279,10 +2279,6 @@ def phase_binaryen(target, options, wasm_target):
22792279
# after generating the wasm, do some final operations
22802280

22812281
if final_js:
2282-
if settings.SUPPORT_BIG_ENDIAN:
2283-
with ToolchainProfiler.profile_block('little_endian_heap'):
2284-
final_js = building.little_endian_heap(final_js)
2285-
22862282
# >=2GB heap support requires pointers in JS to be unsigned. rather than
22872283
# require all pointers to be unsigned by default, which increases code size
22882284
# a little, keep them signed, and just unsign them here if we need that.
@@ -2305,6 +2301,10 @@ def phase_binaryen(target, options, wasm_target):
23052301
if settings.SAFE_HEAP:
23062302
final_js = building.instrument_js_for_safe_heap(final_js)
23072303

2304+
if settings.SUPPORT_BIG_ENDIAN:
2305+
with ToolchainProfiler.profile_block('little_endian_heap'):
2306+
final_js = building.little_endian_heap(final_js)
2307+
23082308
if settings.OPT_LEVEL >= 2 and settings.DEBUG_LEVEL <= 2:
23092309
# minify the JS. Do not minify whitespace if Closure is used, so that
23102310
# Closure can print out readable error messages (Closure will then

0 commit comments

Comments
 (0)