summaryrefslogtreecommitdiffstats
path: root/bin/sh/shell.h
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2011-02-12 23:44:05 +0000
committerjilles <jilles@FreeBSD.org>2011-02-12 23:44:05 +0000
commit2fb060368627dc29279d5ac969e6c3eb6b0e7ea3 (patch)
treecc8681e662bed68e4af8833df6725164bd71882d /bin/sh/shell.h
parent4fe7a7870a6da7d72489d152af4b1a951eb50ae4 (diff)
downloadFreeBSD-src-2fb060368627dc29279d5ac969e6c3eb6b0e7ea3.zip
FreeBSD-src-2fb060368627dc29279d5ac969e6c3eb6b0e7ea3.tar.gz
sh: Detect dividing the smallest integer by -1.
This overflows and on some architectures such as amd64 it generates SIGFPE. Generate an error on all architectures.
Diffstat (limited to 'bin/sh/shell.h')
-rw-r--r--bin/sh/shell.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/bin/sh/shell.h b/bin/sh/shell.h
index 9bf399f..5f6d0ac 100644
--- a/bin/sh/shell.h
+++ b/bin/sh/shell.h
@@ -59,6 +59,8 @@ typedef intmax_t arith_t;
#define ARITH_FORMAT_STR "%" PRIdMAX
#define atoarith_t(arg) strtoimax(arg, NULL, 0)
#define strtoarith_t(nptr, endptr, base) strtoimax(nptr, endptr, base)
+#define ARITH_MIN INTMAX_MIN
+#define ARITH_MAX INTMAX_MAX
typedef void *pointer;
#define MKINIT /* empty */
OpenPOWER on IntegriCloud