[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2025-05-21 15:15:57 +00:00
parent 6e49b3d263
commit c8c708f852

View File

@ -30,11 +30,11 @@ with instrument_imports():
def TestOneInput(data): def TestOneInput(data):
if len(data) < 10: # Skip inputs that are too small if len(data) < 10: # Skip inputs that are too small
return return
try: try:
# Create a BytesIO object from the fuzzer data # Create a BytesIO object from the fuzzer data
image_io = io.BytesIO(data) image_io = io.BytesIO(data)
# Try to open the image # Try to open the image
with Image.open(image_io) as img: with Image.open(image_io) as img:
# Test EXIF extraction # Test EXIF extraction
@ -45,7 +45,7 @@ def TestOneInput(data):
for tag_id, value in exif.items(): for tag_id, value in exif.items():
# Try to get the tag name # Try to get the tag name
tag_name = ExifTags.TAGS.get(tag_id, tag_id) tag_name = ExifTags.TAGS.get(tag_id, tag_id)
# Try to convert GPS info # Try to convert GPS info
if tag_id == 34853: # GPSInfo tag if tag_id == 34853: # GPSInfo tag
for gps_tag, gps_value in value.items(): for gps_tag, gps_value in value.items():
@ -53,7 +53,7 @@ def TestOneInput(data):
except Exception: except Exception:
# Catch exceptions from EXIF processing # Catch exceptions from EXIF processing
pass pass
# Test thumbnail extraction from EXIF # Test thumbnail extraction from EXIF
try: try:
if hasattr(img, 'getexif'): if hasattr(img, 'getexif'):
@ -69,7 +69,7 @@ def TestOneInput(data):
except Exception: except Exception:
# Catch exceptions from thumbnail extraction # Catch exceptions from thumbnail extraction
pass pass
except Exception: except Exception:
# Catch all other exceptions # Catch all other exceptions
pass pass