@@ -326,8 +326,8 @@ def show_tainted_source(zelos, binary_path, trace, taint_path):
326326 zelos .config .source_code_path ,
327327 )
328328
329- # The remaining is debug-only output
330- return
329+ if not zelos . config . taint_output == "terminal" :
330+ return
331331
332332 # print("generated .zcov file")
333333 crash_line = None
@@ -339,23 +339,22 @@ def show_tainted_source(zelos, binary_path, trace, taint_path):
339339 source_path [(file , line )] = v
340340 if file in files :
341341 if crash_line is None :
342- new_line = colored (
342+ files [ file ][ line ] = colored (
343343 # f"!0x{k:x}" +
344344 files [file ][line ] + str (v ) + "\n " ,
345345 color = "red" ,
346346 )
347347 crash_line = line
348348 changed_file_lines [file ].append (line )
349349 else :
350- new_line = colored (
350+ files [ file ][ line ] = colored (
351351 # f"*0x{k:x}" +
352352 files [file ][line ] + str (v ) + "\n " ,
353353 color = "white" ,
354354 attrs = ["bold" ],
355355 )
356356 changed_file_lines [file ].append (line )
357357
358- files [file ][line ] = new_line
359358 # print("Updated source lines with data flow")
360359 count = 0
361360 # Get first trace line that is in the source
@@ -405,10 +404,11 @@ def show_tainted_source(zelos, binary_path, trace, taint_path):
405404 i += 1
406405 if lines_to_print [- 1 ] != "...\n " :
407406 lines_to_print .append ("...\n " )
408- # print("".join(lines_to_print))
407+ print ("" .join (lines_to_print ))
408+
409409 # print("Changed lines: ")
410- # print(changed_lines )
411- # print("Num lines: ", len(changed_lines ))
410+ # print(changed_file_lines )
411+ # print("Num lines: ", len(changed_file_lines ))
412412
413413
414414def process_file (filename , zelos_module_base ):
0 commit comments