1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-26 12:45:20 +03:00
aports/community/deno/stacker-detect-stack-overflow.patch
2023-08-26 15:53:33 +02:00

22 lines
670 B
Diff

From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sat, 15 Jul 2023 21:29:34 +0200
Subject: [PATCH] Detect stack overflow in remaining_stack()
See https://github.com/rust-lang/stacker/pull/51
--- a/vendor/stacker/src/lib.rs
+++ b/vendor/stacker/src/lib.rs
@@ -89,7 +89,12 @@
/// to determine whether a stack switch should be made or not.
pub fn remaining_stack() -> Option<usize> {
let current_ptr = current_stack_ptr();
- get_stack_limit().map(|limit| current_ptr - limit)
+ get_stack_limit().map(|limit| {
+ if current_ptr < limit {
+ panic!("stack overflow!");
+ }
+ current_ptr - limit
+ })
}
psm_stack_information! (