r/ProgrammerHumor • • Jul 20 '18

Every Time

Post image
52.2k Upvotes

749 comments sorted by

View all comments

Show parent comments

154

u/plexxonic Jul 20 '18

I need to hide this in commits.

94

u/[deleted] Jul 20 '18

Hide it in a third party library that you snuck back into Artifactory.

0

u/[deleted] Jul 20 '18

[deleted]

53

u/[deleted] Jul 20 '18

Changing it to mod 31 might prevent someone finding it while it's in debug, but it's still an exception so there's still going to be a stacktrace that points you directly to it. Doesn't matter if the error message is searchable.

0

u/[deleted] Jul 20 '18

[deleted]

27

u/LvS Jul 20 '18

You can see the stacktrace from where your code died.

In C you could mess with the stack pointer and then jump to a random address, but even that can be caught with tools like rr.

What you want to throw is a DNS lookup failure or something that just happens regularly in that piece of code.

12

u/Hdmoney Jul 20 '18

The real way to do it would be by invalidating state in a way that you know will get caught in the future.

3

u/SheepLinux Jul 20 '18

I feel sorry for whoever has to debug/deploy ur horrible horrible mess lol

7

u/FatFingerHelperBot Jul 20 '18

It seems that your comment contains 1 or more links that are hard to tap for mobile users. I will extend those so they're easier for our sausage fingers to click!

Here is link number 1 - Previous text "rr"


Please PM /u/eganwall with issues or feedback! | Delete

2

u/AUTplayed Jul 20 '18

In C you could mess with the stack pointer and then jump to a random address, but even that can be caught with tools like rr.

oh no, why is that a feature? D:

2

u/_realitycheck_ Jul 20 '18

And then hide the result in matrices.

→ More replies (1)

14

u/Kalabasa Jul 20 '18

You can modify the exception's stack trace before throwing.

9

u/[deleted] Jul 20 '18

Wait really? I’ve never seen that or thought to do that before. I guess if people ever do that it’s usually to help debug rather than modify it with malicious intent

10

u/Kalabasa Jul 20 '18

Yeah, at least in Java. I guess it's for frameworks to hide internal stuff (cut off the part of the trace

4

u/citewiki Jul 20 '18

Cutting off... like the parenthes

→ More replies (1)

2

u/[deleted] Jul 20 '18

Hmm I guess I know where that's useful now ...

2

u/DaMaestroable Jul 20 '18

What they should do is to create a new thread and just have it start allocating memory like crazy, and then watch the whole thing grind to a halt.

→ More replies (2)

1

u/piponwa Jul 20 '18

Write an exception from another programming language.

1

u/Holden_Makock Jul 20 '18

Some people just want to see the world burn.

Or rather see me lit my PC.

25

u/WiseassWolfOfYoitsu Jul 20 '18

Although it's a bit aggressive. %2 would be 50% of the time, which would be fairly easy to solve. Also just in one place. I prefer:

#define true (rand() % 10000 == 0)

15

u/slashuslashuserid Jul 20 '18

don't forget to seed that though, and also yours will be triggered 99.99% of the time, not 0.01%

 #include<stdlib.h>
 #include<time.h>
 srand((unsigned int)time(0));
 #ifdef true
     #undef true
 #endif
 #define true (rand() % 10000)

5

u/WiseassWolfOfYoitsu Jul 20 '18

and also yours will be triggered 99.99% of the time, not 0.01%

'doh :)

2

u/Allways_Wrong Jul 21 '18

You also want to only throw it late at night.