r/programming • • Sep 26 '20

Found these comments by a developer inside the Windows Media Player source code leaked with the WinXP files yesterday, sort of hilarious

https://pastebin.com/PTLeWhc2
5.0k Upvotes

397 comments sorted by

View all comments

Show parent comments

237

u/redfournine Sep 26 '20

And when you try to modify it, it breaks in a really funny, unexplainable way, in the weirdest place ever.

446

u/KnowsAboutMath Sep 26 '20
0 == 0; /* Have to keep this in or the whole code stops working ???? */

365

u/VeryOriginalName98 Sep 26 '20

You have a race condition.

0

u/[deleted] Sep 26 '20

[deleted]

63

u/WalkingAFI Sep 26 '20

I had a blessed professor that would give you half credit on any feature not implemented for a project if you as long as you documented it. You could straight up turn in “None of this program works because I did not implement it.” And he’d give you a 50. More practically, I had to use a goto to hack together some poor cleanup logic (it was an optimizing compilers class and I had to do vectorized scheduling of instructions) and he didn’t take of points because there was adequate documentation explaining my awful choices.

11

u/vanderZwan Sep 27 '20

So basically he judges based on how much (or little) technical debt his students create. Good set of priorities, if you ask me

6

u/WalkingAFI Sep 27 '20

He never framed it that way himself, but it makes sense to put it that way. He was all about “a documented bug is a feature.”

43

u/xan1242 Sep 26 '20

Pff just write asm code to move the stack pointer, easy peasy.... and then get your return address overwritten.

I had to hack things together a few times to cave in decompiled code on my own to a game a few times so I unfortunately experienced this many many times. Lots of trial and error (and IDA, before Ghidra was out).

3

u/GlaedrH Sep 27 '20

You might enjoy reading about failure-oblivious computing: https://www.cs.columbia.edu/~junfeng/09fa-e6998/papers/failure-oblivious.pdf

2

u/turunambartanen Sep 27 '20

Might be a trivial question, but why would a full heap/stack prevent a crash?

17

u/throwaway8u3sH0 Sep 26 '20

Which are sometimes a nightmare to debug. I remember after spending days I've been tempted to just add sleep(10) and hope for the best.

→ More replies (1)

25

u/shaenorino Sep 26 '20

You know, yes. But also, sometimes no.

0

u/[deleted] Sep 26 '20

[deleted]

6

u/othermike Sep 26 '20

Or "jein", as they say in Germany.

7

u/dnew Sep 26 '20

Or an uninitialized pointer.

4

u/VeryOriginalName98 Sep 26 '20

That would be a variable assignment, this is just a literal comparison.

13

u/dnew Sep 26 '20

I mean, adding the comparison might move code around such that a different uninitialized pointer access becomes innocuous. Sort of like how adding a printf to figure out what's wrong often fixes it, when it's UB that's wrong.

11

u/VeryOriginalName98 Sep 26 '20

Oh god. I would hate to work on a codebase where this strategy were implemented.

→ More replies (2)
→ More replies (3)

13

u/SlykerPad Sep 26 '20

I was a coop student at Nortel and another team had a bug like this. Basically there were two variable declarations. When the order was change the bug went away.

It was a complier error. Imagine spending a lot of time trying to figure out why a program was crashing only to find out it was a compiler error.

4

u/Quetzacoatl85 Sep 27 '20

I think I'd consider becoming a carpenter after that.

16

u/SteeleDynamics Sep 26 '20

Read: Oh is equal to zero.

4

u/dame_tu_cosita Sep 27 '20

We were trying to interpret a SQL code a programmer left us and this "1 == 1" keep showing around and results that this guy prefer to write that instead of True for reasons.

15

u/hardraada Sep 26 '20

I remember working with a Sybase db 20 some years ago that did a complete data dump and crashed. The cause was a query that had passed a negative value to a string parsing function.

More recently I had a ServiceNow mid server (hey, it's a job) tank because their JDBC probe called a method in the driver for Hadoop that was implemented to throw an exception.

We have met the enemy and they are us :/

→ More replies (3)
→ More replies (1)