Affected fuzzer fix (#3494)

Fixing json decode error with affected fuzzer functionality.
This commit is contained in:
Leo Neat 2020-03-12 12:01:57 -07:00 committed by GitHub
parent da9cbde065
commit b0cd13e3bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -353,8 +353,9 @@ def get_json_from_url(url):
logging.error('HTTP error with url %s.', url)
return None
try:
result_json = json.load(response)
except ValueError as excp:
# read().decode() fixes compatability issue with urllib response object.
result_json = json.loads(response.read().decode())
except (ValueError, TypeError, json.JSONDecodeError) as excp:
logging.error('Loading json from url %s failed with: %s.', url, str(excp))
return None
return result_json