Commit 85998730 authored by Chris Lamb's avatar Chris Lamb 💬

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
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment