Skip to content

Commit

Permalink
Merge pull request #44 from CybercentreCanada/bugfix_doubling_space_f…
Browse files Browse the repository at this point in the history
…orever

Bugfix

    YaraFileProcessor.__replace_for_each_one_to_many() did not handle lines with only spaces or tabs well. Since the non_white_space_index only got set higher then 0 if a non_white_space character
    was found likes without spaces or tabs would double in size.
    Added a check, if non_white_space_index == 0 then set it to the lenghth of the line.
  • Loading branch information
cccs-gm authored Feb 26, 2021
2 parents b691eb2 + f004d60 commit 7c94d0e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions yara-validator/yara_file_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ def __replace_for_each_one_to_many(self, line):
non_white_space_index = index
break

if non_white_space_index == 0:
non_white_space_index = len(line_as_list)
new_list = new_list + line_as_list[non_white_space_index:]

newline = ''.join(new_list)
Expand Down

0 comments on commit 7c94d0e

Please sign in to comment.