summaryrefslogtreecommitdiffstatshomepage
path: root/unix/main.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-05-06 11:40:20 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-05-06 11:43:37 +0300
commitc1e0eb7afe2109a81f6e3ec28f9d01705010500c (patch)
tree3b9bbf381965f9847ed92506f2f1870c1ce30743 /unix/main.c
parent0986675451edbdcbe31d90ddacf8f6dc3327a4ae (diff)
downloadmicropython-c1e0eb7afe2109a81f6e3ec28f9d01705010500c.tar.gz
micropython-c1e0eb7afe2109a81f6e3ec28f9d01705010500c.zip
unix/main: Don't allow to specify too small heap size.
This will lead to crash like: FATAL: uncaught NLR 80a5420 On x86_32, the minimum heap size is smaller, but not 2 times, so just use value which works for x86_64.
Diffstat (limited to 'unix/main.c')
-rw-r--r--unix/main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/unix/main.c b/unix/main.c
index 84570eb9f6..93156d66e6 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -375,6 +375,10 @@ STATIC void pre_process_options(int argc, char **argv) {
if (word_adjust) {
heap_size = heap_size * BYTES_PER_WORD / 4;
}
+ // If requested size too small, we'll crash anyway
+ if (heap_size < 700) {
+ goto invalid_arg;
+ }
#endif
} else {
invalid_arg: