Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OnRuntimeError causes runtime errors when stack/heap collision occurred #13

Closed
oscar-broman opened this issue Mar 24, 2013 · 0 comments
Closed

Comments

@oscar-broman
Copy link

Code:

#include <a_samp>

// Only to make the backtrace small
#pragma dynamic 20

main() {
    RecursionMadness(1500);
}

stock RecursionMadness(i) {
    if (--i >= 0) {
        RecursionMadness(i);
    }
}

Output:

[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0x30, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 00000030 in ?? () from main.amx
[debug] #1 00000028 in ?? () from main.amx
Script[gamemodes/main.amx]: Run time error 3: "Stack/heap collision (insufficient stack size)"

Add this to the code:

forward OnRuntimeError(error_code);
public OnRuntimeError(error_code) {

}

Output:

[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0x30, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 00000030 in ?? () from main.amx
[debug] #1 00000028 in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0x28, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 00000030 in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0x20, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 00000030 in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0x18, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 00000030 in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0x10, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 00000030 in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0x8, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0x0, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFFF8, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFFF0, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFFE8, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFFE0, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFFD8, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFFD0, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFFC8, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFFC0, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFFB8, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFFB0, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFFA8, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFFA0, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFF98, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFF90, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFF88, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFF80, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFF78, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFF70, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
[debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[debug]  Stack pointer (STK) is 0xFFFFFF68, heap pointer (HEA) is 0x0
[debug] AMX backtrace:
[debug] #0 ???????? in ?? () from main.amx
Script[gamemodes/main.amx]: Run time error 3: "Stack/heap collision (insufficient stack size)"
Zeex added a commit that referenced this issue Mar 24, 2013
@Zeex Zeex closed this as completed Mar 25, 2013
@ghost ghost mentioned this issue Sep 20, 2015
Zeex added a commit that referenced this issue Apr 7, 2018
fda6940 Set up asm compilation for occasional manual testing
ded81e7 Add support for NOP (one-byte version) (#28)
698d230 Remove broken version badge
d2ac83c Replace 0 with NULL
0627975 Fix CMake warning about @rpath
3fa84a3 Merge pull request #27 from Y-Less/master
e120562 Made all subhook calls NULL safe, not just one destructor.
8046f66 Merge pull request #26 from tharindud/master
f4614ac Fixing a compiler error in the example C++ code in README.md due to '<<' being specified as '<'
699a6bd Merge pull request #23 from gocha/fix-dtor-nullref
2f9d0c1 Merge pull request #24 from gocha/scoped-install-with-new-handler
46ebdb5 Add new ScopedHookInstall constructor which can set/override the new hook destination
1edbc72 Fix null reference on the destruction of empty Hook
50a8d0c Merge pull request #21 from omgtehlion/patch-1
5607ef9 SUB r/m32, imm32 instruction typo
31a4f0f v0.4
ee6b547 Revert "Enable tests on AppVeyor"
95cd7b4 Properly decode SIB length
0353549 Cleanup
52af4ed Add more logging in test program
e3f5597 Tell CTest to show output on failure
af522f7 Add support for Mac OS
1503a23 Add x64 platform for AppVeryor
2428b50 Configure 32-bit Travis build
1ec5591 Enable tests on AppVeyor
cd97522 Fix relocation bug
c86c12a Add support for REX prefixes
889413d Fix CMake errors
c72e0a2 Return error on overflow
e7a7b14 Remove stupid assert
4f36fb1 Fix test program
d4f4d17 Fix trampoline size calculation
a8d7b78 Enable 64-bit offsets in test program
cdb4c0e Make sure offset fits in 32 bits
93d167a Fix trampoline generation
a55f789 Fix 64-bit jump being overwritten by regular jump
866f38d Update example code
bfdb2b4 Improve C++ interface
cba3854 Fix compile errors in C++ wrapper
d2a5756 Minor cleanup
384cb35 v0.3
bda8b5f Convert tabs to spaces
1b89e7f Return support for 32-bit jumps on x86-64
9551217 Fix pointer cast to smaller type warning
4d2ab7b Cleanup
25ee731 Fix MSVC compile errors
7484593 Merge pull request #13 from RomanHargrave/master
4e1c767 Modify x64 support to use RET rather than JMP

git-subtree-dir: deps/subhook
git-subtree-split: fda6940c20d862bf63c3bfffd16a5a9380b5a471
@Aleks4k Aleks4k mentioned this issue May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants