Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
52 lines (48 loc) · 1.77 KB

File metadata and controls

52 lines (48 loc) · 1.77 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
* @license
* Copyright 2019 The Emscripten Authors
* SPDX-License-Identifier: MIT
*/
#if STACK_OVERFLOW_CHECK
// Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode.
function writeStackCookie() {
#if ASSERTIONS
assert((STACK_MAX & 3) == 0);
#endif
#if WASM_BACKEND
// The stack grows downwards
HEAPU32[(STACK_MAX >> 2)+1] = 0x2135467;
HEAPU32[(STACK_MAX >> 2)+2] = 0x89BACDFE;
#else
HEAPU32[(STACK_MAX >> 2)-1] = 0x2135467;
HEAPU32[(STACK_MAX >> 2)-2] = 0x89BACDFE;
#endif
#if !USE_ASAN
// Also test the global address 0 for integrity.
// We don't do this with ASan because ASan does its own checks for this.
HEAP32[0] = 0x63736d65; /* 'emsc' */
#endif
}
function checkStackCookie() {
#if WASM_BACKEND
var cookie1 = HEAPU32[(STACK_MAX >> 2)+1];
var cookie2 = HEAPU32[(STACK_MAX >> 2)+2];
#else
var cookie1 = HEAPU32[(STACK_MAX >> 2)-1];
var cookie2 = HEAPU32[(STACK_MAX >> 2)-2];
#endif
if (cookie1 != 0x2135467 || cookie2 != 0x89BACDFE) {
abort('Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x' + cookie2.toString(16) + ' ' + cookie1.toString(16));
}
#if !USE_ASAN
// Also test the global address 0 for integrity.
// We don't do this with ASan because ASan does its own checks for this.
if (HEAP32[0] !== 0x63736d65 /* 'emsc' */) abort('Runtime error: The application has corrupted its heap memory area (address zero)!');
#endif
}
#if !MINIMAL_RUNTIME // MINIMAL_RUNTIME moves this to a JS library function
function abortStackOverflow(allocSize) {
abort('Stack overflow! Attempted to allocate ' + allocSize + ' bytes on the stack, but stack has only ' + (STACK_MAX - stackSave() + allocSize) + ' bytes available!');
}
#endif
#endif
Morty Proxy This is a proxified and sanitized view of the page, visit original site.