aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzoulasc <zoulasc@users.noreply.github.com>2019-12-09 02:00:45 -0500
committerArnold Robbins <arnold@skeeve.com>2019-12-09 09:00:45 +0200
commitaf86dacfad85857b2ea9fa95150ddd8c671695ed (patch)
tree3a6fa88debc84b3c07ee614509011e68663912cc
parent416c6db5ee829b5e97dc8001b28e475fd942dbb6 (diff)
downloadone-true-awk-af86dacfad85857b2ea9fa95150ddd8c671695ed.tar.gz
Fix memory corruption manifested on 32 bit binaries (#58)
* Don't update gototab entries for HAT (corrupts memory)
-rw-r--r--b.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/b.c b/b.c
index 407e622..1e53652 100644
--- a/b.c
+++ b/b.c
@@ -1273,7 +1273,8 @@ int cgoto(fa *f, int s, int c)
if (tmpset[j] != p[j])
goto different;
/* setvec is state i */
- f->gototab[s][c] = i;
+ if (c != HAT)
+ f->gototab[s][c] = i;
return i;
different:;
}
@@ -1287,7 +1288,8 @@ int cgoto(fa *f, int s, int c)
p = intalloc(setcnt + 1, __func__);
f->posns[f->curstat] = p;
- f->gototab[s][c] = f->curstat;
+ if (c != HAT)
+ f->gototab[s][c] = f->curstat;
for (i = 0; i <= setcnt; i++)
p[i] = tmpset[i];
if (setvec[f->accept])