From b4ff08d185389e5b540a8e468c00895e1ae83927 Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Sat, 18 Feb 2023 23:56:06 +0200 Subject: [PATCH] Prohibit too big a size --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 5889ae5a67..18f145c334 100644 --- a/main.c +++ b/main.c @@ -142,7 +142,7 @@ STATIC supervisor_allocation *allocate_pystack(safe_mode_t safe_mode) { (void)common_hal_os_getenv_int("CIRCUITPY_PYSTACK_SIZE", &pystack_size); // Check if value is valid pystack_size = pystack_size - pystack_size % sizeof(size_t); // Round down to multiple of 4. - if (pystack_size < 384) { + if ((pystack_size < 384) || (pystack_size > 900000)) { serial_write_compressed(translate("\nInvalid CIRCUITPY_PYSTACK_SIZE\n\n\r")); pystack_size = CIRCUITPY_PYSTACK_SIZE; // Reset }