summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/fuzz_opt.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/scripts/fuzz_opt.py b/scripts/fuzz_opt.py
index 57b1c0400..3ff1cb554 100755
--- a/scripts/fuzz_opt.py
+++ b/scripts/fuzz_opt.py
@@ -1082,15 +1082,16 @@ class TrapsNeverHappen(TestCaseHandler):
# operations, etc.). in that case there is nothing for us to
# compare here; just leave.
return
- call_end = before.index('\n', call_start)
+ # include the line separator in the index, as function names may
+ # be prefixes of each other
+ call_end = before.index(os.linesep, call_start) + 1
# we now know the contents of the call line after which the trap
# happens, which is something like "[fuzz-exec] calling bar", and
# it is unique since it contains the function being called.
call_line = before[call_start:call_end]
- # find that call line, and remove everything from it onward.
- before_index = before.index(call_line)
+ # remove everything from that call line onward.
lines_pre = before.count(os.linesep)
- before = before[:before_index]
+ before = before[:call_start]
lines_post = before.count(os.linesep)
print(f'ignoring code due to trap (from "{call_line}"), lines to compare goes {lines_pre} => {lines_post} ')