From dd4c17e9189ff7068cb9231ae3ee0f5a4640bc46 Mon Sep 17 00:00:00 2001 From: Alex Groce Date: Sat, 14 Jul 2018 11:38:51 -0700 Subject: [PATCH] fix message on program exit to not claim internal error --- bin/deepstate/main_manticore.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bin/deepstate/main_manticore.py b/bin/deepstate/main_manticore.py index 11215f2..74fb714 100644 --- a/bin/deepstate/main_manticore.py +++ b/bin/deepstate/main_manticore.py @@ -265,6 +265,17 @@ def _is_program_crash(reason): return 'Invalid memory access' in reason.message +def _is_program_exit(reason): + """Using the `reason` for the termination of a Manticore `will_terminate_state` + event, decide if we want to treat the termination as a simple exit of the program + being analyzed.""" + + if not isinstance(reason, TerminateState): + return False + + return 'Program finished with exit status' in reason.message + + def done_test(_, state, state_id, reason): """Called when a state is terminated.""" mc = DeepManticore(state) @@ -281,6 +292,10 @@ def done_test(_, state, state_id, reason): # Don't raise new `TerminateState` exception super(DeepManticore, mc).crash_test() + elif _is_program_exit(reason): + L.info("State {} terminated due to program exit: {}".format( + state_id, reason)) + super(DeepManticore, mc).abandon_test() else: L.error("State {} terminated due to internal error: {}".format(state_id, reason))