Skip to content

Commit dd048ec

Browse files
ttlequals0claude
andcommitted
Add HEIC false positive fix for iOS 18 files (v2.5.52)
HEIC files from iOS 18 devices were incorrectly flagged as corrupted due to older libheif versions not supporting shared auxiliary images feature. - Detect libheif "auxiliary image" errors in ImageMagick stderr - Detect "cannot identify" errors on HEIC files in PIL - Treat these as warnings instead of corruption flags - Files now show as "HEIC validation skipped: libheif version limitation" Ref: github.com/strukturag/libheif/issues/1190 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent ec9677b commit dd048ec

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

CHANGELOG.MD

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0).
77

8+
## [2.5.52] - 2026-01-01
9+
10+
### Bug Fixes
11+
12+
- **Fix HEIC false positive corruption detection for iOS 18 files**: HEIC files from iOS 18 devices were incorrectly flagged as corrupted
13+
- Root cause: Older libheif versions (Ubuntu 24.04 ships 1.17.x) don't support iOS 18's use of shared auxiliary images
14+
- Error message: `"Too many auxiliary image references (2.0)"` from libheif/ImageMagick
15+
- This is a valid HEIF structure per spec, not file corruption (see: github.com/strukturag/libheif/issues/1190)
16+
- **Solution**: Detect libheif limitation errors and treat as warnings instead of corruption
17+
- Added detection for "auxiliary image" and "too many auxiliary" errors in ImageMagick stderr
18+
- Added detection for "cannot identify image file" errors on HEIC files in PIL
19+
- Files with this error now show as warning "HEIC validation skipped: libheif version limitation"
20+
- Files are no longer incorrectly marked as corrupted
21+
- Note: Full iOS 18 HEIC support requires libheif 1.19.8+ (not yet available in Ubuntu repos)
22+
- Files affected: `media_checker.py`
23+
24+
---
25+
826
## [2.5.51] - 2026-01-01
927

1028
### Bug Fixes

media_checker.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,14 +909,20 @@ def _check_image_corruption(self, file_path):
909909
except Exception as e:
910910
pil_load_failed = True
911911
pil_load_error = str(e)
912+
error_lower = str(e).lower()
912913
scan_output.append(f"PIL load/transform: FAILED - {str(e)}")
913-
914+
914915
# Check for truncation errors - these indicate actual corruption
915-
if 'truncated' in str(e).lower() or 'bytes not processed' in str(e).lower():
916+
if 'truncated' in error_lower or 'bytes not processed' in error_lower:
916917
logger.warning(f"Image truncation detected for {file_path}: {str(e)}")
917918
corruption_details.append(f"Image file is truncated: {str(e)}")
918919
is_corrupted = True
919920
scan_tool = "pil"
921+
# HEIC files with "cannot identify" may be due to libheif limitations, not corruption
922+
# Don't mark as corrupted here - let ImageMagick verify (which will also catch the libheif error)
923+
elif is_heic and 'cannot identify image file' in error_lower:
924+
logger.info(f"HEIC PIL load failed (may be libheif limitation) for {file_path}: {str(e)}")
925+
# Don't mark as corrupted yet - ImageMagick will provide the definitive answer
920926

921927
logger.info(f"Starting ImageMagick verification for: {file_path}")
922928

@@ -959,6 +965,15 @@ def _check_image_corruption(self, file_path):
959965
if is_gif and 'improper image header' in stderr_lower and 'readgifimage' in stderr_lower:
960966
# This is a common false positive for GIFs that still work
961967
logger.info(f"GIF header warning (not corruption) for {file_path}")
968+
# Check for HEIC/HEIF libheif limitation errors (iOS 18 files with shared auxiliary images)
969+
# These are NOT corruption - older libheif versions don't support newer HEIC features
970+
# See: https://github.com/strukturag/libheif/issues/1190
971+
elif is_heic and ('auxiliary image' in stderr_lower or 'too many auxiliary' in stderr_lower):
972+
warning_details.append("HEIC validation skipped: libheif version limitation (file likely valid)")
973+
scan_output.append("ImageMagick HEIC: SKIPPED (libheif limitation - not corruption)")
974+
scan_output.append(f"Note: iOS 18+ HEIC files may use features not supported by older libheif versions")
975+
logger.info(f"HEIC libheif limitation (not corruption) for {file_path}: {result.stderr[:100]}")
976+
# Don't mark as corrupted - this is a tool limitation, not file corruption
962977
else:
963978
corruption_details.append("ImageMagick pixel validation failed")
964979
is_corrupted = True

version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Default version - this is the single source of truth
55

66

7-
_DEFAULT_VERSION = '2.5.51'
7+
_DEFAULT_VERSION = '2.5.52'
88

99

1010
# Allow override via environment variable for CI/CD, but default to the hardcoded version

0 commit comments

Comments
 (0)