From 6d64e78dc55a805a38137d11c0bf7f673737fb93 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 7 Apr 2023 10:30:00 -0700 Subject: [PATCH 1/7] Undo NULL file protection in 1990/dds As part of the redefinition of INABIAF the NULL file protection was removed. The bus error fix, the erroneous prototype to fopen() and the fgets() fix are still applied as these allow the entry to work properly (and without an obnoxious warning at compile, linking or runtime about gets()). --- 1990/dds/README.md | 2 +- 1990/dds/dds.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/1990/dds/README.md b/1990/dds/README.md index f1bb03903..3fbe8b5a5 100644 --- a/1990/dds/README.md +++ b/1990/dds/README.md @@ -16,7 +16,7 @@ you Yusuke! [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) removed the erroneous prototype to `fopen()` and made this use `fgets()` instead of `gets()` to make -it safer. He also fixed a segfault in the case that the file cannot be loaded. +it safer and to prevent a potentially alarming warning at linking or runtime. Thank you Cody for your assistance! ## To run diff --git a/1990/dds/dds.c b/1990/dds/dds.c index b615faeb5..a7585e669 100644 --- a/1990/dds/dds.c +++ b/1990/dds/dds.c @@ -17,7 +17,7 @@ X'R':B[2]!='M'&&(l=*--C)X'I':B[1]=='N'?fgets(p=B,R,stdin),P[*d]=S():(*(q=Q(B,"TH ()))X'G':p=B+4,B[2]=='S'&&(*C++=l,p++),l=S()-1 X'F':*(q=Q(B,"TO"))=0;p=B+5;P[i =B[3]]=S();p=q+2;M[i]=S();L[i]=l X'N':++P[*d]<=M[*d]&&(l=L[*d]);}else p=B+2,P[ *B]=S();l++;}X'L':N printf(I)X'N':N(free(m[i]),0),m[i]=0 X'B':_ 0 t('S',5,"w",N -f&&fprintf(f,I))t('O',4,"r",while(f&&fgets(B,R,f))(*Q(B,"\n")=0,G()))X 0:default:G() +fprintf(f,I))t('O',4,"r",while(fgets(B,R,f))(*Q(B,"\n")=0,G()))X 0:default:G() ;}_ 0;}G(){l=atoi(B);m[l]&&(free(m[l]),0);(p=Q(B," "))?strcpy(m[l]=malloc(strlen(p )),p+1):(m[l]=0,0);}O(S,J,'=',==,'#',!=)O(J,K,'<',<,'>',>)O(K,V,'$',<=,'!',>=) O(V,W,'+',+,'-',-)O(W,Y,'*',*,'/',/)Y(){int o;_*p=='-'?p++,-Y():*p>='0'&&*p<= From 2ed80eb224d072a8f8ccfb7488eb68bdf8a7cd1b Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 7 Apr 2023 10:33:41 -0700 Subject: [PATCH 2/7] Undo no arg check in 2020/burton As part of INABIAF redefinition the check for arg number is removed. Instead the README.md and Makefile warn about it. --- 2020/burton/Makefile | 1 + 2020/burton/README.md | 6 +----- 2020/burton/prog.c | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/2020/burton/Makefile b/2020/burton/Makefile index 879b1c46f..f1f55007e 100644 --- a/2020/burton/Makefile +++ b/2020/burton/Makefile @@ -141,6 +141,7 @@ all: data ${TARGET} supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c + @echo "NOTE: this entry will crash on no arg specified." ${CC} ${CFLAGS} -DB=${B} -DI=${I} -DT=${T} -DS=${S} $< -o $@ ${LIBS} ${PROG}_le: ${PROG}.c diff --git a/2020/burton/README.md b/2020/burton/README.md index 8f8e1b3d1..477110bc1 100644 --- a/2020/burton/README.md +++ b/2020/burton/README.md @@ -16,11 +16,7 @@ make ./prog arg ... ``` -[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) made this entry not -segfault when no arg is specified though he notes that the author says it will -segfault on zero args. He did NOT fix the strange results when more than one arg -is specified. Thank you Cody for your assistance! - +NOTE: this entry will crash on no arg specified. ## Try: diff --git a/2020/burton/prog.c b/2020/burton/prog.c index 67c915521..60be69261 100644 --- a/2020/burton/prog.c +++ b/2020/burton/prog.c @@ -1 +1 @@ -int main(int b,char**i){if(1[i]){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}} +int main(int b,char**i){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);} From cdc2cffdd0955264fb3f604303e3e7b4b409df6f Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 7 Apr 2023 10:36:44 -0700 Subject: [PATCH 3/7] Undo no arg check in 1990/theorem As part of the redefinition of INABIAF one of the segfault fixes has been undone. The others were necessary as part of making the entry work in modern systems but this one should not have been done. Instead the Makefile and README.md warn about it. I did however discover another bug with this entry that makes one of the generated programs not work. I documented that in bugs.md and I'll look at it another time. --- 1990/theorem/Makefile | 1 + 1990/theorem/README.md | 28 ++++++++++++++-------------- 1990/theorem/theorem.c | 1 - 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/1990/theorem/Makefile b/1990/theorem/Makefile index 758bf8cac..cf9710a31 100644 --- a/1990/theorem/Makefile +++ b/1990/theorem/Makefile @@ -133,6 +133,7 @@ all: data ${TARGET} supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c + @echo "NOTE: this entry will segfault on no arg specified." ${CC} ${CFLAGS} $< -o $@ ${LIBS} sorter.c: ${PROG} ${PROG}.c diff --git a/1990/theorem/README.md b/1990/theorem/README.md index 2aeba6a60..d85a4675f 100644 --- a/1990/theorem/README.md +++ b/1990/theorem/README.md @@ -1,10 +1,10 @@ # Best of Show - Adrian Mariano - University of Washington - 2729 72nd Ave SE - Mercer Island, WA 98040 - USA +Adrian Mariano +University of Washington +2729 72nd Ave SE +Mercer Island, WA 98040 +USA ## To build: @@ -12,13 +12,12 @@ make all [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed some segfaults -under modern (and in some cases earlier) systems with this entry. He also fixed -a segfault if not enough args are used. Originally we noted that the 4 trailing -args '0 0 0 0' were required on systems that dump core when NULL is dereferenced -but this problem showed itself in modern systems even with the 4 '0 0 0 0'. To -make this easier for users Cody also kindly fixed this problem. Finally he -changed this program to use `fgets()` not `gets()` to make it safer. Thank you -Cody for your assistance! +under modern (and in some cases earlier) systems with this entry. Originally we +noted that the 4 trailing args '0 0 0 0' were required on systems that dump core +when NULL is dereferenced but this problem showed itself in modern systems even +with the 4 '0 0 0 0'. Finally he changed this program to use `fgets()` not +`gets()` to make it safer and to prevent a warning about `gets()` at linking or +runtime. Thank you Cody for your assistance! [Yusuke Endoh](/winners.html#Yusuke_Endoh) pointed out that `atof` nowadays needs `#include ` which was used in order to get this to work @@ -37,6 +36,7 @@ where: h - step size y1 - initial value (y(x1) == y1) +NOTE: this entry will segfault on no arg specified. ## Try: @@ -76,7 +76,7 @@ reversing filter! Try: Still not impressed? The author throws in for free, a sort program! Try: - cc sorter.c -o sorter + make sorter ls | ./sorter This program is safe for home use as well. The author has @@ -89,7 +89,7 @@ And finally, as a special offer to users of this entry, the author provides a Fibonacci sequence generator! Try: ./sorter 0 0 0 0 < theorem.c > fibonacci.c - cc fibonacci.c -o fibonacci + make fibonacci ./fibonacci 1 1 ./fibonacci 2 1 diff --git a/1990/theorem/theorem.c b/1990/theorem/theorem.c index cd2c619aa..db1d0de8b 100644 --- a/1990/theorem/theorem.c +++ b/1990/theorem/theorem.c @@ -24,7 +24,6 @@ w(g,R,u)float*g,u;char R; /**/{int b,f;A=atoi(++a);b=atoi(++a);while((f=A+b)<15000){printf("%d\n",f);A=b;b=f;}} main(A,a)int A;char*a[]; o o -if (a[1]==NULL||a[2]==NULL||a[3]==NULL||a[4]==NULL||a[5]==NULL) return 1; if(!strcmp(*++a,"-r"))S(); D=atof(*++a); T=atof(*++a); From 28624ca43f4ff646e2815ee8f4620788665a3b3e Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 7 Apr 2023 10:41:06 -0700 Subject: [PATCH 4/7] Undo arg check in 1993/plummer As part of redefining INABIAF the check for args was removed. Instead it's warned about in the Makefile and README.md file. --- 1993/plummer/Makefile | 1 + 1993/plummer/README.md | 5 ++--- 1993/plummer/plummer.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/1993/plummer/Makefile b/1993/plummer/Makefile index d2d7073e1..c7f3f4a75 100644 --- a/1993/plummer/Makefile +++ b/1993/plummer/Makefile @@ -128,6 +128,7 @@ all: data ${TARGET} supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c + @echo "NOTE: this program will crash with not enough args." ${CC} ${CFLAGS} $< -o $@ ${LIBS} # alternative executable diff --git a/1993/plummer/README.md b/1993/plummer/README.md index 9dc3b64fb..3da60d124 100644 --- a/1993/plummer/README.md +++ b/1993/plummer/README.md @@ -18,9 +18,8 @@ where: number is a number (try 21701) arg is any argument -[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) added a check in the -code so that it will not segfault if not enough args are specified. Thank you -Cody! + +NOTE: this entry will crash without enough args. ## Judges' comments: diff --git a/1993/plummer/plummer.c b/1993/plummer/plummer.c index af348c6f8..d0c61daa2 100644 --- a/1993/plummer/plummer.c +++ b/1993/plummer/plummer.c @@ -1 +1 @@ -char*_,*O;main(S,l)char**l;{if(S>2){*(O=*(l+++S-1)-1)=13,*l[1]=0;for(;;)for(printf(*l),_=O-1;_>=*l&&++*_>(S+*O+S)*S;*_--=(S+*O)*S);}} +char*_,*O;main(S,l)char**l;{*(O=*(l+++S-1)-1)=13,*l[1]=0;for(;;)for(printf(*l),_=O-1;_>=*l&&++*_>(S+*O+S)*S;*_--=(S+*O)*S);} From 4e6630575c7b777c05f27a8fdaaa644cdb53d657 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 7 Apr 2023 10:42:42 -0700 Subject: [PATCH 5/7] Undo NULL file check in 1993/schnitzi As part of the redefinition of INABIAF the NULL file check has been removed. Instead it's noted in the README.md and Makefile. --- 1993/schnitzi/Makefile | 1 + 1993/schnitzi/README.md | 17 +++++++++-------- 1993/schnitzi/schnitzi.c | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/1993/schnitzi/Makefile b/1993/schnitzi/Makefile index 27f04ced1..345b26c31 100644 --- a/1993/schnitzi/Makefile +++ b/1993/schnitzi/Makefile @@ -128,6 +128,7 @@ all: data ${TARGET} supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c + @echo "NOTE: this entry will segfault if the file cannot be opened." ${CC} ${CFLAGS} $< -o $@ ${LIBS} # alternative executable diff --git a/1993/schnitzi/README.md b/1993/schnitzi/README.md index 49ae8ccc0..5b92d982e 100644 --- a/1993/schnitzi/README.md +++ b/1993/schnitzi/README.md @@ -1,18 +1,17 @@ # Obfuscated Intelligence Award: - Mark Schnitzius - 1700 Woodbury Rd. #1208 - Orlando, FL 32828 - USA +Mark Schnitzius +1700 Woodbury Rd. #1208 +Orlando, FL 32828 +USA ## To build: make all -[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this to not -segfault when no file is specified or the file cannot be opened for reading. He -also made this use `fgets()` not `gets()` to make it safer. Thank you Cody for -your assistance! +[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) made this use `fgets()` +not `gets()` to make it safer and to prevent a warning with linking or at +runtime. Thank you Cody for your assistance! ## To run: @@ -22,6 +21,8 @@ where: file a file containing some text +NOTE: this entry will segfault if the file cannot be opened. + ## Try: ./schnitzi schnitzi.info diff --git a/1993/schnitzi/schnitzi.c b/1993/schnitzi/schnitzi.c index a51e8ab4c..55c4232b3 100644 --- a/1993/schnitzi/schnitzi.c +++ b/1993/schnitzi/schnitzi.c @@ -13,9 +13,9 @@ ( lll>l1 ) li|=! ( l[3*l1+++3 ] -ll[strlen ( ll)-1] ) ;return ( li ) ;}main ( ll,lll - ) char*lll[];{if(ll<2)return 1;char l1 [111][21], li1[111][21],il1[111],i1l + ) char*lll[];{char l1 [ 111][21],li1[111][21 ] ,il1[111],i1l [ 111 ] ;int lli,l11,l1l,li/* ( */,ll1,il,l;FILE*f;if(ll-2 - ) {f=fopen ( lll[1],"r" );if(!f)return 1;lli=l=ll1=il=!1;while + ) {f=fopen ( lll[1],"r" ) ;lli=l=ll1=il=!1;while ( fscanf(f,"%s",l1[lli] ) +1){li=ii ( l1[lli],3 ) ;iii ( l1[lli] ) ;l1l=l11=!1;while ( l1l>-ll ) {iii ( lll[-l1l] From ad9efe502a7d1ecfb9c4cd7a97ae1d501d7beafe Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 7 Apr 2023 10:46:28 -0700 Subject: [PATCH 6/7] Undo two checks in 1998/schnitzi As part of the redefinition of INABIAF two segfault fixes were undone. These are noted in the Makefile and README.md file. One fix was necessary and that has been left alone. --- 1998/schnitzi/Makefile | 1 + 1998/schnitzi/README.md | 10 ++++------ 1998/schnitzi/schnitzi.c | 5 ++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/1998/schnitzi/Makefile b/1998/schnitzi/Makefile index 2fc43b251..ea859aa34 100644 --- a/1998/schnitzi/Makefile +++ b/1998/schnitzi/Makefile @@ -130,6 +130,7 @@ all: data ${TARGET} supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c + @echo "NOTE: this program will crash on invalid input." ${CC} ${CFLAGS} $< -o $@ ${LIBS} # alternative executable diff --git a/1998/schnitzi/README.md b/1998/schnitzi/README.md index d29442d0d..39ce33971 100644 --- a/1998/schnitzi/README.md +++ b/1998/schnitzi/README.md @@ -28,12 +28,10 @@ echo 324 >> data ./sort < data -[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed three segfaults in -this entry. The first was caused by invalid data types. The second was triggered -if one did not specify any arg. The third happened if the arg was had any -characters that were not the digits 1 - 9 (if it started with 0 it could work as -long as another digit followed it and there were no other non-digits). Thank you -Cody for your assistance! +[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed invalid data +types which prevented this entry from working. There are two other segfaults +that should not be fixed and they are discussed in [bugs.md](/bugs.md). Thank +you Cody for your assistance! NOTE: the larger the number the number of lines of output can become substantially higher as well. Doing `./schnitzi 9` will actually print 771999 diff --git a/1998/schnitzi/schnitzi.c b/1998/schnitzi/schnitzi.c index 02be0399f..1104eeb63 100644 --- a/1998/schnitzi/schnitzi.c +++ b/1998/schnitzi/schnitzi.c @@ -52,6 +52,5 @@ void x_(){ O=g; *r=y[k-2]; _=r; j=o_; } void d (){ O=g; *r=y[k]; _=r; k=k+1; m=k Date: Fri, 7 Apr 2023 10:50:35 -0700 Subject: [PATCH 7/7] Move author info to first column in 2015/endoh3 --- 2015/endoh3/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/2015/endoh3/README.md b/2015/endoh3/README.md index ccb94c202..784f14828 100644 --- a/2015/endoh3/README.md +++ b/2015/endoh3/README.md @@ -1,8 +1,8 @@ # Back to the Future Award - Yusuke Endoh - - Twitter: @mametter +Yusuke Endoh + +Twitter: @mametter ## To build: