better control on base parameters
authorLaurent Mazet <mazet@softndesign.org>
Tue, 28 Feb 2023 13:15:02 +0000 (14:15 +0100)
committerLaurent Mazet <mazet@softndesign.org>
Tue, 28 Feb 2023 13:15:30 +0000 (14:15 +0100)
parser.c

index 119733f9afb4e613347558d9db50cc0f367a9f06..77013e389665d0968da61faa83f8575e14d3d59f 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -641,9 +641,9 @@ int format (int precision)
 
 void base (int in, int out)
 {
-    if (in > 0) {
+    if ((in > 0) && (in < 37)) {
         set_base (in, in);
-        if (out > 0) {
+        if ((out > 0) && (out < 37)) {
             set_base (in, out);
         } else if (out != - 1) {
             VERBOSE (WARNING, fprintf (stdout, "error incorrect output base (%d)\n", out));
@@ -931,7 +931,7 @@ double evaluate_element (element_t *root, char mask)
     case Precision:
         return format ((int)op0);
     case Base:
-        base (op0, op1);
+        base ((int)op0, (int)op1);
         break;
     }