From f004d6031773ac12d4c10539fbba38dbc26bb171 Mon Sep 17 00:00:00 2001 From: cccs-gm <56171373+cccs-gm@users.noreply.github.com> Date: Thu, 25 Feb 2021 16:55:15 -0500 Subject: [PATCH] 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. --- yara-validator/yara_file_processor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yara-validator/yara_file_processor.py b/yara-validator/yara_file_processor.py index a179f53..cc46b71 100644 --- a/yara-validator/yara_file_processor.py +++ b/yara-validator/yara_file_processor.py @@ -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)