From c1e0eb7afe2109a81f6e3ec28f9d01705010500c Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky <pfalcon@users.sourceforge.net>
Date: Sat, 6 May 2017 11:40:20 +0300
Subject: [PATCH] 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.
---
 unix/main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/unix/main.c b/unix/main.c
index 84570eb9f..93156d66e 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:
-- 
GitLab