1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-05-05 23:26:38 +02:00

52591: printf builtin must pass metafied strings to math evaluation

This commit is contained in:
Stephane Chazelas 2024-02-24 20:41:33 -08:00 committed by Bart Schaefer
parent 4b9cd6b8bd
commit 4c0ebc155e
2 changed files with 11 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2024-02-24 Bart Schaefer <schaefer@zsh.org>
* Stephane: 52591: Src/builtin.c: printf builtin must pass
metafied strings to math evaluation
2024-02-23 Bart Schaefer <schaefer@zsh.org>
* 52583: Src/params.c, Test/V10private.ztst: do an extra check

View File

@ -5247,7 +5247,8 @@ bin_print(char *name, char **args, Options ops, int func)
}
}
if (*argp) {
width = (int)mathevali(*argp++);
width = (int)mathevali(metafy(*argp, len[argp - args], META_USEHEAP));
argp++;
if (errflag) {
errflag &= ~ERRFLAG_ERROR;
ret = 1;
@ -5281,7 +5282,8 @@ bin_print(char *name, char **args, Options ops, int func)
}
if (*argp) {
prec = (int)mathevali(*argp++);
prec = (int)mathevali(metafy(*argp, len[argp - args], META_USEHEAP));
argp++;
if (errflag) {
errflag &= ~ERRFLAG_ERROR;
ret = 1;
@ -5465,7 +5467,7 @@ bin_print(char *name, char **args, Options ops, int func)
*d++ = 'l';
#endif
*d++ = 'l', *d++ = *c, *d = '\0';
zlongval = (curarg) ? mathevali(curarg) : 0;
zlongval = (curarg) ? mathevali(metafy(curarg, curlen, META_HEAPDUP)) : 0;
if (errflag) {
zlongval = 0;
errflag &= ~ERRFLAG_ERROR;
@ -5516,7 +5518,7 @@ bin_print(char *name, char **args, Options ops, int func)
if (!curarg)
zulongval = (zulong)0;
else if (!zstrtoul_underscore(curarg, &zulongval))
zulongval = mathevali(curarg);
zulongval = mathevali(metafy(curarg, curlen, META_HEAPDUP));
if (errflag) {
zulongval = 0;
errflag &= ~ERRFLAG_ERROR;