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<= 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); 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);} 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] 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 - Twitter: @mametter +Yusuke Endoh + +Twitter: @mametter ## To build: 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*)&_);}