MCPcopy Create free account
hub / github.com/GoogleChrome/samples / checkStackCookie

Function checkStackCookie

mkbitmap/mkbitmap.js:468–484  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

466}
467
468function checkStackCookie() {
469 if (ABORT) return;
470 var max = _emscripten_stack_get_end();
471 // See writeStackCookie().
472 if (max == 0) {
473 max += 4;
474 }
475 var cookie1 = HEAPU32[((max)>>2)];
476 var cookie2 = HEAPU32[(((max)+(4))>>2)];
477 if (cookie1 != 0x02135467 || cookie2 != 0x89BACDFE) {
478 abort('Stack overflow! Stack cookie has been overwritten at ' + ptrToString(max) + ', expected hex dwords 0x89BACDFE and 0x2135467, but received ' + ptrToString(cookie2) + ' ' + ptrToString(cookie1));
479 }
480 // Also test the global address 0 for integrity.
481 if (HEAPU32[0] !== 0x63736d65 /* 'emsc' */) {
482 abort('Runtime error: The application has corrupted its heap memory area (address zero)!');
483 }
484}
485
486// end include: runtime_stack_check.js
487// include: runtime_assertions.js

Callers 3

initRuntimeFunction · 0.85
preMainFunction · 0.85
postRunFunction · 0.85

Calls 2

ptrToStringFunction · 0.85
abortFunction · 0.70

Tested by

no test coverage detected