Last active
October 25, 2019 19:22
-
-
Save Cryptophobia/974c257a1a97766edf9044a60c1a44d0 to your computer and use it in GitHub Desktop.
SegmentationFault.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# recursive.sh | |
# | |
# ./recursive.sh | |
# Segmentation fault (core dumped) | |
# | |
# set -e | |
# trap 'case $? in | |
# 139) echo "segfault occurred"; sleep 20; | |
# esac' CHLD && ./recursive.sh | |
recursive() { | |
# Recursion to make stack grow | |
# Stack is allocated each time function is called | |
while true; do | |
recursive | |
done | |
} | |
recursive | |
set -e | |
trap 'case $? in | |
139) echo "segfault occurred"; sleep 20; | |
esac' CHLD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Next, figure out how to catch SIGSEGV within bash and how to change ulimits during execution of the recursion. :)