How to Catch Code Corruption

27 views
Skip to first unread message

Mark Meier

unread,
Dec 3, 2019, 11:04:41 AM12/3/19
to emscripten-discuss
I have a pretty hefty program (~12Mb) which works well for the most part. It uses WebGL and an HTML5 Canvas object. I can throw source from numerous files at it and it behave ok. The problem is when I start resizing the Canvas I encounter corruption of the code. A function that has been called previously all of a sudden has a invalid fetch. The C++ code does not show any memory problems running in a normal Window or Linux environment.

I have compile Emscripten with:

 -s ALLOW_MEMORY_GROWTH=1 -s ASSERTIONS=2 -s NO_EXIT_RUNTIME=1 -s RESERVED_FUNCTION_POINTERS=20 -s ASYNCIFY=1 -s USE_WEBGL2=1 -s DEMANGLE_SUPPORT=1 -g4 -s DISABLE_EXCEPTION_CATCHING=0 -s WASM=1 -s SAFE_HEAP=1 -s STACK_OVERFLOW_CHECK=1 -s LEGACY_VM_SUPPORT=0 -s TOTAL_STACK=33554432 -s TOTAL_MEMORY=67108864 -fsanitize-address-field-padding=2048 -fsanitize-address-globals-dead-stripping -fsanitize-address-use-after-scope -fsanitize-memory-track-origins -fsanitize-memory-use-after-dtor -fsanitize=address,undefined,memory 

But it still doesn't show any problem until the fatal fetch.

Are there any other tools I can use to try to root out this problem?

Thanks, Mark.

Alon Zakai

unread,
Dec 3, 2019, 12:28:23 PM12/3/19
to emscripte...@googlegroups.com
Hmm, those look like all the relevant flags already. The one thing I'd worry about is if they don't all work together properly for some reason. I'd try for example just running with the sanitizers, but none of the emscripten-specific ones (SAFE_HEAP, STACK_OVERFLOW_CHECK).

Also note that you need to pass the sanitizer flags during compile, and not just link, and that they only work with the upstream backend (default since 1.39.0).

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/d47b1ac1-d6ad-4368-b541-5a1b3d76f5c7%40googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages