@@ -224,7 +224,7 @@ def process_afl_test_cases(cargs):
224
224
logr ("\n \n ++++++ BEGIN - first exec output for CMD: %s" % \
225
225
(cargs .coverage_cmd .replace ('AFL_FILE' , f )),
226
226
cov_paths ['log_file' ], cargs )
227
- for line in out_lines :
227
+ for line in out_lines . decode ( "ascii" ) :
228
228
logr (" %s" % (line ), cov_paths ['log_file' ], cargs )
229
229
logr ("++++++ END\n " , cov_paths ['log_file' ], cargs )
230
230
@@ -619,16 +619,16 @@ def lcov_gen_coverage(cov_paths, cargs):
619
619
620
620
def log_coverage (out_lines , log_file , cargs ):
621
621
for line in out_lines :
622
- m = re .search ('^\s+(lines\.\..*\:\s.*)' , line )
622
+ m = re .search ('^\s+(lines\.\..*\:\s.*)' , line . decode ( "ascii" ) )
623
623
if m and m .group (1 ):
624
624
logr (" " + m .group (1 ), log_file , cargs )
625
625
else :
626
- m = re .search ('^\s+(functions\.\..*\:\s.*)' , line )
626
+ m = re .search ('^\s+(functions\.\..*\:\s.*)' , line . decode ( "ascii" ) )
627
627
if m and m .group (1 ):
628
628
logr (" " + m .group (1 ), log_file , cargs )
629
629
else :
630
630
if cargs .enable_branch_coverage :
631
- m = re .search ('^\s+(branches\.\..*\:\s.*)' , line )
631
+ m = re .search ('^\s+(branches\.\..*\:\s.*)' , line . decode ( "ascii" ) )
632
632
if m and m .group (1 ):
633
633
logr (" " + m .group (1 ),
634
634
log_file , cargs )
@@ -724,17 +724,17 @@ def run_cmd(cmd, log_file, cargs, collect, aflrun, fn, timeout=None):
724
724
725
725
if cargs .disable_cmd_redirection or collect == WANT_OUTPUT \
726
726
or collect == LOG_ERRORS :
727
- with open (fh .name , 'r' , encoding = 'ISO-8859-1 ' ) as f :
727
+ with open (fh .name , 'rb ' ) as f :
728
728
for line in f :
729
- out .append (line .rstrip ('\n ' ))
729
+ out .append (line .rstrip (b '\n ' ))
730
730
os .unlink (fh .name )
731
731
732
732
if (es != 0 ) and (collect == LOG_ERRORS or collect == WANT_OUTPUT ):
733
733
if log_file :
734
734
logr (" Non-zero exit status '%d' for CMD: %s" % (es , cmd ),
735
735
log_file , cargs )
736
736
for line in out :
737
- logr (line , log_file , cargs )
737
+ logr (line . decode ( "ascii" ) , log_file , cargs )
738
738
else :
739
739
print (" Non-zero exit status '%d' for CMD: %s" % (es , cmd ))
740
740
@@ -844,13 +844,13 @@ def is_bin_gcov_enabled(binary, cargs):
844
844
### run readelf against the binary to see if it contains gcov support
845
845
for line in run_cmd ("%s -a %s" % (cargs .readelf_path , binary ),
846
846
False , cargs , WANT_OUTPUT , False , "" )[1 ]:
847
- if ' __gcov' in line :
847
+ if b ' __gcov' in line :
848
848
if cargs .validate_args or cargs .gcov_check or cargs .gcov_check_bin :
849
849
print ("[+] Binary '%s' is compiled with code coverage support via gcc." % binary )
850
850
rv = True
851
851
break
852
852
853
- if '__llvm_gcov' in line :
853
+ if b '__llvm_gcov' in line :
854
854
if cargs .validate_args or cargs .gcov_check or cargs .gcov_check_bin :
855
855
print ("[+] Binary '%s' is compiled with code coverage support via llvm." % binary )
856
856
rv = True
0 commit comments