diff options
author | ru <ru@FreeBSD.org> | 2005-05-16 19:11:36 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2005-05-16 19:11:36 +0000 |
commit | 8003014f216927129ca9d82bdc33396bfe5abc33 (patch) | |
tree | bcacbdba8e94a07f1e42b063f0416a10c104b509 /contrib/one-true-awk/run.c | |
parent | d80e4b8864237dd8cfd9e7338eec81cfc2c29b99 (diff) | |
parent | 78d66df18b9755543261f33b621153a97634a136 (diff) | |
download | FreeBSD-src-8003014f216927129ca9d82bdc33396bfe5abc33.zip FreeBSD-src-8003014f216927129ca9d82bdc33396bfe5abc33.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r146299,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/one-true-awk/run.c')
-rw-r--r-- | contrib/one-true-awk/run.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/contrib/one-true-awk/run.c b/contrib/one-true-awk/run.c index 4648c83..5f29a64 100644 --- a/contrib/one-true-awk/run.c +++ b/contrib/one-true-awk/run.c @@ -26,6 +26,7 @@ THIS SOFTWARE. #include <stdio.h> #include <ctype.h> #include <setjmp.h> +#include <limits.h> #include <math.h> #include <string.h> #include <stdlib.h> @@ -705,12 +706,16 @@ Cell *gettemp(void) /* get a tempcell */ Cell *indirect(Node **a, int n) /* $( a[0] ) */ { + Awkfloat val; Cell *x; int m; char *s; x = execute(a[0]); - m = (int) getfval(x); + val = getfval(x); /* freebsd: defend against super large field numbers */ + if ((Awkfloat)INT_MAX < val) + FATAL("trying to access out of range field %s", x->nval); + m = (int) val; if (m == 0 && !is_number(s = getsval(x))) /* suspicion! */ FATAL("illegal field $(%s), name \"%s\"", s, x->nval); /* BUG: can x->nval ever be null??? */ @@ -1257,6 +1262,8 @@ Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */ goto spdone; } } while (nematch(pfa,s)); + pfa->initstat = tempstat; /* bwk: has to be here to reset */ + /* cf gsub and refldbld */ } n++; sprintf(num, "%d", n); |