mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-09-22 03:40:47 +02:00
25025: check radix for integer constants is between 2 and 36 inclusive
This commit is contained in:
parent
547adf2021
commit
b86c191af5
@ -1,3 +1,9 @@
|
||||
2008-05-14 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 25025: Doc/Zsh/builtins.yo, Src/builtin.c, Src/math.c,
|
||||
Src/utils.c: more checks to ensure radix for arithmetic
|
||||
constants is between 2 and 36 inclusive.
|
||||
|
||||
2008-05-13 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 25018: Omari Norman: Completion/Unix/Command/{_awk,_cut,_join}:
|
||||
|
@ -1555,7 +1555,7 @@ for non-special parameters.
|
||||
item(tt(-i))(
|
||||
Use an internal integer representation. If var(n) is nonzero it
|
||||
defines the output arithmetic base, otherwise it is determined by the
|
||||
first assignment.
|
||||
first assignment. Bases from 2 to 36 inclusive are allowed.
|
||||
)
|
||||
item(tt(-E))(
|
||||
Use an internal double-precision floating point representation. On output
|
||||
|
@ -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;
|
||||
|
||||
|
@ -460,6 +460,10 @@ zzlex(void)
|
||||
}
|
||||
if(*ptr != ']')
|
||||
goto bofs;
|
||||
if (outputradix < 2 || outputradix > 36) {
|
||||
zerr("invalid base: %d", outputradix);
|
||||
return EOI;
|
||||
}
|
||||
ptr++;
|
||||
break;
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user