Share your repls and programming experiences

← Back to all posts
Single line code that can start a segmentation fault
AcceleratedCode (37)

What started as a attempt to make a quine turned into a chaotic-1 line destruction code.

This increases the system recursion limit to its max and makes a fork bomb

Such code can be copy pasted into a insecured server and destroy it completely.

Check it out and try to make it simpler if it is even possible

This post has been locked
retronbv (103)

Thing is this only works in python

hello1964 (26)

I don't get the point

Nettakrim (391)

this is the best i could do but it goes across multiple lines

def x():x()
import sys;sys.setrecursionlimit(9**9);x()

its 4 characters shorter including the newline, but obviously it isnt one line so its sort of cheating

never mind! ive manged to make it a whole 3 characters shorter than yours AND its on one line!

 import sys;sys.setrecursionlimit(9**9);x=lambda:x();x()
#import sys;s='exec(s)';sys.setrecursionlimit(9**9);exec(s)
Jeydin21 (61)

Yo, this is like the most useful post I've seen so far, now I can go troll my friends woohoo

FlaminHotValdez (196)

The pinnacle of perfection in coding. This one line can be inserted anywhere into a code and completely destroy it. Hmm wonder if I can hack into the repl database and put it into other people's code 🤔🤔🤔

FlaminHotValdez (196)

Also I didn't know recursion limit was a thing. How every educational ;)

FishingFights (202)

good to see the community still upvotes actually cool code implementation instead of just games!

DynamicSquid (4532)

What is a recursion limit? I tried running the code without the limit and it stopped after 496. Does the recursion limit increase that number?

AcceleratedCode (37)

@DynamicSquid Basically a limit on how many times a function can call itself. Removing the recursion limit / setting it to a really high number means that the function executes itself over and over until the python interpreter seg-faults

JosephSanthosh (1188)

Haha! @CodeLongAndPros is gonna unlist this post for low effort immediately. Smh...good job! Hope this doesn't get taken down by mods.

CodeLongAndPros (1536)

@JosephSanthosh I don’t know, I think it’s actually pretty cool. Now breaking a eval builtins={} and segfaulting…

AcceleratedCode (37)

@CodeLongAndPros Wait, theres a event? I never wanted this to be in the event, but thats cool!

AcceleratedCode (37)

The 10k Grand Prize event, that one? Wait, do we have to apply or do mods choose it from the share / tell section? I am a little confused

EpicGamer007 (1023)

The 10k grand prize event is the programming language jam. You and a team of people have to create a programming language.

It ended near the end of August and the judges are currently judging the submissions. No more submissions are allowed.

This repl is not a part of the event.

AcceleratedCode (37)

@EpicGamer007 Oh... I thought the judges would review programs and see the best one, thats cool though

MocaCDeveloper (523)

Lol, this is cool. Nice!!

MocaCDeveloper (523)

@AcceleratedCode Let me take a wild guess where this is crashing at:

Where you execute the s variable, since you are executing a variable that is yet again executing itself..etc..etc

AcceleratedCode (37)

@MocaCDeveloper It would normally crash with recursion limit, but setting it to 9**9 (really high number) would mean there isn't a limit, and then it segmentation fault-crashes, which can't be caught by a except loop, which is why this is so dangerous

firefish (877)

@AcceleratedCode 9 to the power of 9 is 387420489, according to google. Massive number, so SIGSEGV.