"""Apply process limits before executing a trusted conversion helper.""" import os import resource import sys memory, file_bytes, *command = sys.argv[1:] resource.setrlimit(resource.RLIMIT_AS, (int(memory), int(memory))) resource.setrlimit(resource.RLIMIT_FSIZE, (int(file_bytes), int(file_bytes))) resource.setrlimit(resource.RLIMIT_CORE, (0, 0)) os.execv(command[0], command)