about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/builtin.c4
-rw-r--r--Src/math.c4
-rw-r--r--Src/utils.c2
3 files changed, 9 insertions, 1 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index f11d5aa51..99eef93aa 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1744,6 +1744,10 @@ typeset_setbase(const char *name, Param pm, Options ops, int on, int always)
 		zwarnnam(name, "bad precision value: %s", arg);
 	    return 1;
 	}
+	if (pm->base < 2 || pm->base > 36) {
+	    zwarnnam(name, "invalid base: %d", pm->base);
+	    return 1;
+	}
     } else if (always)
 	pm->base = 0;
 
diff --git a/Src/math.c b/Src/math.c
index e1cde5f03..3374efddd 100644
--- a/Src/math.c
+++ b/Src/math.c
@@ -460,6 +460,10 @@ zzlex(void)
 		}
 		if(*ptr != ']')
 			goto bofs;
+		if (outputradix < 2 || outputradix > 36) {
+		    zerr("invalid base: %d", outputradix);
+		    return EOI;
+		}
 		ptr++;
 		break;
 	    }
diff --git a/Src/utils.c b/Src/utils.c
index d3319f0a9..4992680fe 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1834,7 +1834,7 @@ zstrtol(const char *s, char **t, int base)
 	    base = 8;
     }
     inp = s;
-    if (base > 36) {
+    if (base < 2 || base > 36) {
 	zerr("invalid base: %d", base);
 	return (zlong)0;
     } else if (base <= 10)