Prohibit too big a size

This commit is contained in:
Bill Sideris 2023-02-18 23:56:06 +02:00
parent d7e6a78ef4
commit b4ff08d185
No known key found for this signature in database
GPG Key ID: 1BEF1BCEBA58EA33

2
main.c
View File

@ -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
}