Skip to content
Snippets Groups Projects
Commit 74ca80df authored by Conrad Ratschan's avatar Conrad Ratschan Committed by Chris Lamb
Browse files

Fix FIT image detection for larger image files. (MR: !75)

Use manual magic comparison for FIT images (device tree blob) to work
around a bug in libmagic that results in device tree blob files not
correctly being identified when the structure section is larger than 1MB.

libmagic bug report: https://bugs.astron.com/view.php?id=232



Signed-off-by: Chris Lamb's avatarChris Lamb <lamby@debian.org>
parent c0a19a22
No related branches found
No related tags found
No related merge requests found
Pipeline #224186 passed
......@@ -96,12 +96,13 @@ class FlattenedImageTreeFile(File):
"""
DESCRIPTION = "Flattened Image Tree blob files"
FILE_TYPE_RE = re.compile(r"^Device Tree Blob")
CONTAINER_CLASSES = [FitContainer]
@classmethod
def recognizes(cls, file):
if not cls.FILE_TYPE_RE.search(file.magic_file_type):
# Detect file magic manually to workaround incorrect detection of devicetree
# by libmagic when the devicetree structure section is larger than 1MB
if file.file_header[:4] != b"\xd0\x0d\xfe\xed":
return False
if not tool_check_installed("fdtdump"):
......
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