Skip to content

Commit 640d355

Browse files
committed
set memory limits to protect against memory bombs
1 parent 6f1c8aa commit 640d355

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎v3/web_exec.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818
import sys
1919

2020

21+
# set ~50MB limit on virtual memory to protect against memory bombs such as:
22+
#
23+
# x = 2
24+
# while True: x = x*x
25+
import resource
26+
resource.setrlimit(resource.RLIMIT_AS, (50000000,50000000))
27+
28+
2129
# set to true if you want to log queries in DB_FILE
2230
LOG_QUERIES = False
2331

0 commit comments

Comments
 (0)