Skip to content
Snippets Groups Projects
Commit 85998730 authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

comparators.utils.file: Handle case where a file to be "fuzzy" matched does...

comparators.utils.file: Handle case where a file to be "fuzzy" matched does not contain enough entropy despite being over 512 bytes. (Closes: #882981)
parent 893a1e72
No related branches found
No related tags found
No related merge requests found
......@@ -257,7 +257,11 @@ class File(object, metaclass=abc.ABCMeta):
for buf in iter(lambda: f.read(32768), b''):
h.update(buf)
h.final()
self._fuzzy_hash = h.hexdigest()
try:
self._fuzzy_hash = h.hexdigest()
except ValueError:
# File must contain a certain amount of randomness.
self._fuzzy_hash = None
else:
self._fuzzy_hash = None
return self._fuzzy_hash
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment