From 690b442867e500424904cf60cbeb52a03a8d6a22 Mon Sep 17 00:00:00 2001 From: Yazan Boshmaf Date: Mon, 24 Jul 2023 17:17:28 +0300 Subject: [PATCH] Fixes #3 by escaping the rlimit modification on non-Linux systems --- bin/analyzer.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/bin/analyzer.py b/bin/analyzer.py index d0ea0f1d..9d263de3 100644 --- a/bin/analyzer.py +++ b/bin/analyzer.py @@ -9,6 +9,7 @@ import shlex import re import time +import platform from src.project import Project from src.cfg import opcodes from src.slicing import interesting_slices, slice_to_program @@ -242,16 +243,17 @@ def main(): savefilebase = args.savefile or args.file - # limit default memory to 6GB - if args.memory: - mem_limit = int(args.memory) * 1024 * 1024 * 1024 - else: - mem_limit = 6 * 1024 * 1024 * 1024 - try: - rsrc = resource.RLIMIT_VMEM - except: - rsrc = resource.RLIMIT_AS - resource.setrlimit(rsrc, (mem_limit, mem_limit)) + # limit default memory to 6GB on Linux + if platform.system() == 'Linux': + if args.memory: + mem_limit = int(args.memory) * 1024 * 1024 * 1024 + else: + mem_limit = 6 * 1024 * 1024 * 1024 + try: + rsrc = resource.RLIMIT_VMEM + except: + rsrc = resource.RLIMIT_AS + resource.setrlimit(rsrc, (mem_limit, mem_limit)) initial_storage = dict() if args.initial_storage_file: