Skip to content

Commit

Permalink
Compilers are unsafe, so treat them as such
Browse files Browse the repository at this point in the history
  • Loading branch information
Xyene committed Feb 18, 2017
1 parent c389e7d commit 069d183
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dmoj/executors/base_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,10 @@ def get_compile_process(self):
return self.TimedPopen(self.get_compile_args(), **kwargs)

def get_compile_output(self, process):
return process.communicate()[1]
# Use safe_communicate because otherwise, malicious submissions can cause a compiler
# to output hundreds of megabytes of data as output before being killed by the time limit,
# which effectively murders the MySQL server waiting on the server.
return safe_communicate(process, None, outlimit=65536, errlimit=65536)[1]

def get_compiled_file(self):
return self._file(self.problem)
Expand Down

0 comments on commit 069d183

Please sign in to comment.