Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the return status check of subprocess #531

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions boofuzz/utils/debugger_thread_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ def run(self):
exit_info = os.waitpid(self.pid, 0)
self.exit_status = exit_info[1] # [0] is the pid

default_reason = "Process died for unknown reason"
if self.exit_status is not None:
msg = ""

if self.exit_status:
if os.WCOREDUMP(self.exit_status):
reason = "Segmentation fault"
elif os.WIFSTOPPED(self.exit_status):
Expand All @@ -166,9 +167,10 @@ def run(self):
elif os.WIFEXITED(self.exit_status):
reason = "Exit with code - " + str(os.WEXITSTATUS(self.exit_status))
else:
reason = default_reason
else:
reason = default_reason
reason = "Process died for unknown reason"
msg += "[{0}] Crash. Exit code: {1}. Reason - {2}\n".format(
time.strftime("%I:%M.%S"), self.exit_status, reason
)

outdata = None
errdata = None
Expand All @@ -180,9 +182,6 @@ def run(self):
msg="Expired waiting for process {0} to terminate".format(self._process.pid), level=1
)

msg = "[{0}] Crash. Exit code: {1}. Reason - {2}\n".format(
time.strftime("%I:%M.%S"), self.exit_status if self.exit_status is not None else "<unknown>", reason
)
if errdata is not None:
msg += "STDERR:\n{0}\n".format(errdata.decode("ascii"))
if outdata is not None:
Expand Down