More progress with 2011/richards in macOS

I have found a problem that shows itself in both linux and macOS. In
linux it happens with both 32-bit and 64-bit but the sizes are naturally
different. It does not crash in linux however where it does in macOS.

I changed some variable types a bit as well but this still does not fix
it with macOS though they types changed are more consistent with what
they are used as.

The bugs.md has more information on what I discovered (noted above) - an
overflow.

More will have to be done on this another time in order to get it to
work with macOS.
This commit is contained in:
Cody Boone Ferguson committed 2023-05-02 09:45:30 -07:00
1 parent 5c4f7ac088
commit d9d3c2af20
3 files changed
+74 -24

No files matched your search

+2 -2
View File
@@ -61,11 +61,11 @@ CDEFINE=
# Include files that are needed to compile
#
CINCLUDE= -include stdlib.h -include string.h -include stdio.h -include ctype.h
CINCLUDE= -include stdlib.h -include string.h -include stdio.h -include ctype.h -include sys/mman.h -include setjmp.h
# Optimization
#
OPT= -O3
OPT=
# Default flags for ANSI C compilation
#
+9 -9
View File
@@ -24,11 +24,11 @@
#define H 9<<16
#define I case
#define J(i) calloc(i,1)
#define W(c) e=(k*)memcpy(e,x[(u)c],y[(u)c])+y[(u)c];
#define W(c) e=(o*)memmove(e,x[(u)c],y[(u)c])+y[(u)c];
#define N break; I
q char k;
q void o;
q int u;
q unsigned long u;
q o(*f) (vo o *);
q struct {
u *a, **R, *m, h, c;
@@ -43,7 +43,7 @@ u sk[H];
k *w;
o *x[H];
u y[H];
k *j, *e;
f *j, *e;
u l=256;
o g(u v)
{
@@ -123,15 +123,15 @@ o T()
o rd(u v)
{
k *a = 0, **b = &a, **c = b + 32;
o *a = 0, **b = &a, **c = b + 24;
x[v] = w;
for (; b < c && (*b < w || *b > (k *) T || *b == (k *) (long) v); b++);
for (; b < c && (*b < (o *)w || *b > (o *) T || *b == (long) v); b++);
if (b == c) {
jmp_buf *j = alloca(sizeof(*j));
setjmp(*j);
rd(v);
} else {
y[v] = *b - w;
y[v] = *b - (o*)w;
w = *b;
}
}
@@ -146,7 +146,7 @@ o re(vo k * rec)
} F(d) M--;
*M /= M[1];
} F(p) printf("%d\n", *M);
} F(p) printf("%lu\n", *M);
} F(x) u n = *M--;
if (!S j[n])
@@ -165,7 +165,7 @@ lx(d);
o *lib1[] = { T, T, T, T, T } ;
o *lib2[] = { T, ld, lp, lx, l1 } ;
u main()
int main()
{
u i;
k *b;
@@ -192,7 +192,7 @@ u main()
#if NM
malloc(H);
#else
mmap(NULL, H, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
mmap(NULL, H, -1, MAP_ANON | MAP_PRIVATE, -1, 0);
#endif
while (b = fgets(malloc(999), 999, stdin))
((f) K(b, d)) (d);