File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -138,8 +138,12 @@ def collect_stats(kernel_repo, cve_patch):
138
138
if not os .path .exists (file_path ):
139
139
continue
140
140
141
- fp_contents = [line .rstrip ('\n ' ) for line in
142
- open (file_path , 'r' ) if line .strip ()]
141
+ try :
142
+ fp_contents = [line .rstrip ('\n ' ) for line in
143
+ open (file_path , 'r' ) if line .strip ()]
144
+ except UnicodeDecodeError :
145
+ print ("[E] Failed to read file: " + file_path + ", skipping!" )
146
+ continue
143
147
144
148
# we need this array so we can check the above block
145
149
all_added = []
@@ -191,8 +195,12 @@ def collect_stats(kernel_repo, cve_patch):
191
195
if not os .path .exists (file_path ):
192
196
continue
193
197
194
- fp_contents = [line .rstrip ('\n ' ) for line in
195
- open (file_path , 'r' ) if line .strip ()]
198
+ try :
199
+ fp_contents = [line .rstrip ('\n ' ) for line in
200
+ open (file_path , 'r' ) if line .strip ()]
201
+ except UnicodeDecodeError :
202
+ print ("[E] Failed to read file: " + file_path + ", skipping!" )
203
+ continue
196
204
197
205
for i in range (0 , len (fp_contents )):
198
206
lines = fp_contents [i :i + 2 ]
You can’t perform that action at this time.
0 commit comments