From 1f6e7f2aa0244f14bfb8ce485a281fd3c9167d54 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 29 Mar 2023 11:34:54 -0700 Subject: [PATCH] Fix another segfault in 1998/schnitzi The program would also crash if the arg had any character that's not a digit or if the arg had only 0s in it (it would work if it had 0 followed by a digit other than 0). In other words if it is converted to 0 it would segfault. The bugs.md file has been updated as well to note what's also now in the README.md file: even a relatively small number can cause a substantial amount of lines of output. For instance the number 9 causes 771999 lines (!!) of output. --- 1998/schnitzi/README.md | 12 ++++++++++-- 1998/schnitzi/schnitzi.c | 5 +++-- bugs.md | 12 +++++++++++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/1998/schnitzi/README.md b/1998/schnitzi/README.md index f93864eb8..171907f36 100644 --- a/1998/schnitzi/README.md +++ b/1998/schnitzi/README.md @@ -28,9 +28,17 @@ echo 324 >> data ./sort < data -[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed two segfaults in +[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. Thank you Cody for your assistance! +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! + +NOTE: the larger the number the number of lines of output can become +substantially higher as well. Doing `./schnitzi 9` will actually print 771999 +lines! + ## Judges' comments diff --git a/1998/schnitzi/schnitzi.c b/1998/schnitzi/schnitzi.c index d4730b09f..02be0399f 100644 --- a/1998/schnitzi/schnitzi.c +++ b/1998/schnitzi/schnitzi.c @@ -52,5 +52,6 @@ void x_(){ O=g; *r=y[k-2]; _=r; j=o_; } void d (){ O=g; *r=y[k]; _=r; k=k+1; m=k