MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / checkStackCookie

Function checkStackCookie

src/runtime_stack_check.js:34–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32}
33
34function checkStackCookie() {
35#if !MINIMAL_RUNTIME
36 if (ABORT) return;
37#endif
38 var max = _emscripten_stack_get_end();
39#if RUNTIME_DEBUG >= 2
40 dbg(`checkStackCookie: ${ptrToString(max)}`);
41#endif
42 // See writeStackCookie().
43 if (max == 0) {
44 max += 4;
45 }
46 var cookie1 = {{{ makeGetValue('max', 0, 'u32') }}};
47 var cookie2 = {{{ makeGetValue('max', 4, 'u32') }}};
48 if (cookie1 != 0x02135467 || cookie2 != 0x89BACDFE) {
49 abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`);

Callers 5

initRuntimeFunction · 0.70
preamble.jsFile · 0.70
runIterFunction · 0.50
libpthread.jsFile · 0.50
libcore.jsFile · 0.50

Calls 2

ptrToStringFunction · 0.85
dbgFunction · 0.50

Tested by

no test coverage detected