Skip to content
This repository was archived by the owner on Oct 28, 2023. It is now read-only.

Commit 0e5e14f

Browse files
committed
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.
1 parent a4c8a1f commit 0e5e14f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

unix/main.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,12 +351,20 @@ STATIC void pre_process_options(int argc, char **argv) {
351351
heap_size *= 1024;
352352
} else if ((*end | 0x20) == 'm') {
353353
heap_size *= 1024 * 1024;
354+
} else {
355+
// Compensate for ++ below
356+
--end;
357+
}
358+
if (*++end != 0) {
359+
goto invalid_arg;
354360
}
355361
if (word_adjust) {
356362
heap_size = heap_size * BYTES_PER_WORD / 4;
357363
}
358364
#endif
359365
} else {
366+
invalid_arg:
367+
printf("Invalid option\n");
360368
exit(usage(argv));
361369
}
362370
a++;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy