diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-07-08 20:45:15 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-07-08 20:49:41 +0300 |
commit | 0e5e14fe7cd97fa83e822c1e105cf498dbb4d276 (patch) | |
tree | 6200b749a249f44ef8f40cfd67b46bd359d782a1 /unix | |
parent | a4c8a1ffe86ace0b4394d751a2d3716f7d865ba6 (diff) | |
download | micropython-0e5e14fe7cd97fa83e822c1e105cf498dbb4d276.tar.gz micropython-0e5e14fe7cd97fa83e822c1e105cf498dbb4d276.zip |
unix/main: Error out on unknown value of suffix in -X heapsize= option.
E.g. -X heapsize=16Kfoo, -X heapsize=1G will lead to error.
Diffstat (limited to 'unix')
-rw-r--r-- | unix/main.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/unix/main.c b/unix/main.c index a463d2e10a..17423de4d1 100644 --- a/unix/main.c +++ b/unix/main.c @@ -351,12 +351,20 @@ STATIC void pre_process_options(int argc, char **argv) { heap_size *= 1024; } else if ((*end | 0x20) == 'm') { heap_size *= 1024 * 1024; + } else { + // Compensate for ++ below + --end; + } + if (*++end != 0) { + goto invalid_arg; } if (word_adjust) { heap_size = heap_size * BYTES_PER_WORD / 4; } #endif } else { +invalid_arg: + printf("Invalid option\n"); exit(usage(argv)); } a++; |