diff --git a/2024/ferguson1/README.md b/2024/ferguson1/README.md index 15fd1fc4e..eaa28b6b1 100644 --- a/2024/ferguson1/README.md +++ b/2024/ferguson1/README.md @@ -56,10 +56,11 @@ inside this C code. :-) > Fun fact: after winning this, the author played the game in gdb from start to finish and not counting macros but counting all function calls (not libc functions just the few functions in prog.c), there were a total of **985** (!) -line jumps. The prog.c, counting `#include`s, `#define`s, functions and some -lines that have only braces, as well as 14 blank lines, has only 85 lines. A -very tiny fraction of the time a line might be repeated in a row ONCE but that -does not really matter. +line jumps. Skipping prog.c function calls and it's still **776** jumps! The +prog.c, if you remove `#include`s, blank lines, lines with just a brace and +lines that have only variables, has only 59 lines of code. A very tiny fraction +of the time a line might be repeated in a row ONCE but that does not really +matter. **NOTE**: I actually submitted two versions. This one is not encrypted. The encrypted one even encrypted emojis without having to decrypt them in order to @@ -3256,18 +3257,21 @@ Except on the Oregon Trail. I was right too: the entire game is worse, far far worse. After this won I did a full sequence. This is from start to finish and I include it for your amusement -(see [gotos.txt](gotos.txt)). Or horror. There are a few times where the line +(see [gotos.txt](gotos.txt) for the line changes including calls to prog.c +functions). Or horror. There are a few times where the line is the same but that only shows how very often the line changes. It is a total -of **985** (!) changes, counting function calls (i.e. each call to one of the few -functions is a jump); calls to the macros are not counted. +of **985** (!) changes, counting function calls, and **776** (!) excluding +function calls. Macros are not counted of course. -This is in a program that is **JUST 85 (!) lines**! A program that has only 85 lines -COUNTING the `#include`s, `#define`s, other functions and 14 blank lines that -jumps 985 times is astonishing. Of course that's not the only technique but the -title of the award and the judges' remarks are rather fitting as it is -diabolical to follow this code (and the theme of the game fits as well); the -[obfuscation.html](obfuscation.html) shows even more on this - and the other -things I did as well. +This program, if you remove blank lines and lines with just a brace, +`#include`s and only variables, has a mere 59 (!) lines. + +A program that has only 59 lines of code that jumps 985 (counting functions) or +776 (just in main()) times is astonishing. Of course that's not the +only technique but the title of the award and the judges' remarks are rather +fitting as it is diabolical to follow this code (and the theme of the game fits +as well); the [obfuscation.html](obfuscation.html) shows even more on this - and +the other things I did as well. > I have yet to see a single study that supported the supposition that GOTOs are harmful (I presume this is not because nobody has tried). Nonetheless, people @@ -3280,16 +3284,17 @@ said was missing. And it was about time. Not that it didn't happen before. But he was wrong. It is not about not trying. But even IF he WAS right, he -sure as hell is WRONG NOW. Anyone who thinks otherwise needs to try and debug +sure as hell is wrong NOW. Anyone who thinks otherwise needs to try and debug my program - or maintain it. Or write it. -It would have been SO MUCH EASIER if I did not use 134 `goto`s. Actually, even a +It would have been SO MUCH EASIER if I did not use 134 `goto`s (and I could have +fit more in). Actually, even a tiny portion of that would make it harder. Nobody, whether they're in their right mind or not, would WANT to maintain this, or something even close to it. Feel free to pass on judgement to me. I welcome it! You have to be mad and -embrace it to do this. I went full out and if I didn't have to do other things -(or felt like fewer events would be worth it) I would have done even more -`goto`s for this very reason. +embrace it to do this. I went full out and I could have fit more `goto`s in: not +only is the iocccsize not 2503 but I could have removed some events if I really +wanted more `goto`s. Even flex/bison code, which as far as I am aware uses FAR fewer `goto`s, is notorious for `goto`s and is quite hard to follow. It would be a nightmare to @@ -3421,9 +3426,10 @@ the degree I have taken it in this program, it demonstrates why you should avoid No matter how many you have, UNLESS IT'S 0, it makes it hard to maintain and ensure that the code is correct. So how did I actually manage doing exactly that? Very carefully - and I nearly lost my mind doing it. I will not make any -judgement on anyone else who uses them. +judgement on anyone else who uses them, although I will talk about the notion +that they aren't harmful, mostly to show just how extreme this program went. -Anyway, I am even reminded of Apple's **SINGLE** misplaced `goto` that caused a +Anyway, I am reminded of Apple's **SINGLE** misplaced `goto` that caused a **SECURITY HOLE** (CVE-2014-1266): . That's all it takes: **JUST ONE `goto` led to a CVE**! diff --git a/2024/ferguson1/index.html b/2024/ferguson1/index.html index a06407596..24da10042 100644 --- a/2024/ferguson1/index.html +++ b/2024/ferguson1/index.html @@ -499,10 +499,11 @@ inside this C code. :-)

Fun fact: after winning this, the author played the game in gdb from start to finish and not counting macros but counting all function calls (not libc functions just the few functions in prog.c), there were a total of 985 (!) -line jumps. The prog.c, counting #includes, #defines, functions and some -lines that have only braces, as well as 14 blank lines, has only 85 lines. A -very tiny fraction of the time a line might be repeated in a row ONCE but that -does not really matter.

+line jumps. Skipping prog.c function calls and it’s still 776 jumps! The +prog.c, if you remove #includes, blank lines, lines with just a brace and +lines that have only variables, has only 59 lines of code. A very tiny fraction +of the time a line might be repeated in a row ONCE but that does not really +matter.

NOTE: I actually submitted two versions. This one is not encrypted. The encrypted one even encrypted emojis without having to decrypt them in order to @@ -3090,17 +3091,19 @@ I’m a dragon. I’m not a dragon. I have a secret for you: dragons don’t exi Except on the Oregon Trail.

I was right too: the entire game is worse, far far worse. After this won I did a full sequence. This is from start to finish and I include it for your amusement -(see gotos.txt). Or horror. There are a few times where the line +(see gotos.txt for the line changes including calls to prog.c +functions). Or horror. There are a few times where the line is the same but that only shows how very often the line changes. It is a total -of 985 (!) changes, counting function calls (i.e. each call to one of the few -functions is a jump); calls to the macros are not counted.

-

This is in a program that is JUST 85 (!) lines! A program that has only 85 lines -COUNTING the #includes, #defines, other functions and 14 blank lines that -jumps 985 times is astonishing. Of course that’s not the only technique but the -title of the award and the judges’ remarks are rather fitting as it is -diabolical to follow this code (and the theme of the game fits as well); the -obfuscation.html shows even more on this - and the other -things I did as well.

+of 985 (!) changes, counting function calls, and 776 (!) excluding +function calls. Macros are not counted of course.

+

This program, if you remove blank lines and lines with just a brace, +#includes and only variables, has a mere 59 (!) lines.

+

A program that has only 59 lines of code that jumps 985 (counting functions) or +776 (just in main()) times is astonishing. Of course that’s not the +only technique but the title of the award and the judges’ remarks are rather +fitting as it is diabolical to follow this code (and the theme of the game fits +as well); the obfuscation.html shows even more on this - and +the other things I did as well.

I have yet to see a single study that supported the supposition that GOTOs are harmful (I presume this is not because nobody has tried). Nonetheless, people @@ -3112,15 +3115,16 @@ dismiss any statement opposing it.

said was missing. And it was about time. Not that it didn’t happen before. But he was wrong.

It is not about not trying. But even IF he WAS right, he -sure as hell is WRONG NOW. Anyone who thinks otherwise needs to try and debug +sure as hell is wrong NOW. Anyone who thinks otherwise needs to try and debug my program - or maintain it. Or write it.

-

It would have been SO MUCH EASIER if I did not use 134 gotos. Actually, even a +

It would have been SO MUCH EASIER if I did not use 134 gotos (and I could have +fit more in). Actually, even a tiny portion of that would make it harder. Nobody, whether they’re in their right mind or not, would WANT to maintain this, or something even close to it. Feel free to pass on judgement to me. I welcome it! You have to be mad and -embrace it to do this. I went full out and if I didn’t have to do other things -(or felt like fewer events would be worth it) I would have done even more -gotos for this very reason.

+embrace it to do this. I went full out and I could have fit more gotos in: not +only is the iocccsize not 2503 but I could have removed some events if I really +wanted more gotos.

Even flex/bison code, which as far as I am aware uses FAR fewer gotos, is notorious for gotos and is quite hard to follow. It would be a nightmare to try and maintain without the .l/.y source files.

@@ -3228,8 +3232,9 @@ the degree I have taken it in this program, it demonstrates why you should avoid

No matter how many you have, UNLESS IT’S 0, it makes it hard to maintain and ensure that the code is correct. So how did I actually manage doing exactly that? Very carefully - and I nearly lost my mind doing it. I will not make any -judgement on anyone else who uses them.

-

Anyway, I am even reminded of Apple’s SINGLE misplaced goto that caused a +judgement on anyone else who uses them, although I will talk about the notion +that they aren’t harmful, mostly to show just how extreme this program went.

+

Anyway, I am reminded of Apple’s SINGLE misplaced goto that caused a SECURITY HOLE (CVE-2014-1266): https://www.blackduck.com/blog/understanding-apple-goto-fail-vulnerability-2.html. That’s all it takes: JUST ONE goto led to a CVE!

diff --git a/2024/ferguson1/obfuscation.html b/2024/ferguson1/obfuscation.html index 166e508b2..17a5eb4cf 100644 --- a/2024/ferguson1/obfuscation.html +++ b/2024/ferguson1/obfuscation.html @@ -510,16 +510,16 @@ YES I think it’s HILARIOUS. But if it was not for the IOCCC… Well, as I mention in my remarks above, EVEN ONE IS TOO MANY in real code.

I dare you to run the program in a debugger from start to finish to see how many -line jumps there truly are. After I won I did it once: in a program with just 85 -lines (14 blank, some with just a brace, #includes, #defines included) there -were a total of 985 line changes (a tiny tiny fraction had the same line number -repeated once). I rarely went to the fort and I only hunted once (I might not -have hunted at all). This is obscene.

+line jumps there truly are. After I won I did it once: removing the #includes, +blank lines, lines with only variables and lines with just braces (i.e. only +lines of code) the program has just 59 lines and in a single run there were a +total of 985 (!) line changes, counting function calls. In main() itself +the line changed a total of 776 (!) times!

The best (or worst, depending on how you look at it :-) ) part is this works. As -I note in those concluding remarks, a company actually introduced a security -hole from ONE goto. Yet I have 116/134 and it actually works? That is surely -obscene. And beautiful.

-

Oh and BTW: it appears that hines is a bit confused about my submission, +I note in those concluding remarks, a famous company +actually introduced a security hole from ONE goto. Yet I have 116/134 and it +actually works? That is surely obscene. And beautiful.

+

Oh and BTW: it appears that hines is a bit confused about my entry, though I’m not really sure why. In any case, I not only have dethroned hines (sorry …but also not sorry!) but I have, as noted already, beaten the original BASIC game by 7 more gotos at 116 before the cpp and 25 MORE after the diff --git a/2024/ferguson1/obfuscation.md b/2024/ferguson1/obfuscation.md index d768cdd41..103c7868f 100644 --- a/2024/ferguson1/obfuscation.md +++ b/2024/ferguson1/obfuscation.md @@ -68,18 +68,18 @@ mention in my [remarks above](#devil), EVEN ONE IS TOO MANY in real code. I dare you to run the program in a debugger from start to finish to see how many -line jumps there truly are. After I won I did it once: in a program with just 85 -lines (14 blank, some with just a brace, `#include`s, `#define`s included) there -were a total of 985 line changes (a tiny tiny fraction had the same line number -repeated once). I rarely went to the fort and I only hunted once (I might not -have hunted at all). This is obscene. +line jumps there truly are. After I won I did it once: removing the `#include`s, +blank lines, lines with only variables and lines with just braces (i.e. only +lines of code) the program has just 59 lines and in a single run there were a +total of **985** (!) line changes, counting function calls. In `main()` itself +the line changed a total of **776** (!) times! The best (or worst, depending on how you look at it :-) ) part is this works. As -I note in those concluding remarks, a company actually introduced a security -hole from ONE `goto`. Yet I have 116/134 and it actually works? That is surely -obscene. And beautiful. +I note in those concluding remarks, a [famous company](https://www.apple.com) +actually introduced a security hole from ONE `goto`. Yet I have 116/134 and it +actually works? That is surely obscene. And beautiful. -Oh and BTW: it appears that `hines` is a bit confused about my submission, +Oh and BTW: it appears that `hines` is a bit confused about my entry, though I'm not really sure why. In any case, I not only have dethroned `hines` (sorry ...but also not sorry!) but I have, as noted already, beaten the original BASIC game by **7** more `goto`s at 116 before the cpp and **25 MORE** after the