Accept the exact four-byte padding emitted by older mkimage releases
alongside the eight-byte padding used for flat_dt today.
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Derive the trailing padding length while validating external ranges.
Attribute linked ranges to their owning image. Only accept a fully read
zero-filled tail of the expected length as mkimage padding.
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
FIT inventory reported complete coverage whenever the devicetree and
image ranges were valid, even when bytes followed the last of them.
OpenWrt sysupgrade images carry metadata and an fwtool signature there,
and recovery images pad to 64 KiB; neither was exposed or mentioned.
The FIT structure now reports its extent, the first byte after the
devicetree and every external image range. Bytes past it leave coverage
unknown with a limitation naming their size and offset. Up to 7 zero
bytes after external image data stay accounted for, since mkimage -E
pads the last image to its 4- or 8-byte alignment.
Closes#16230
The ASAR reader declared complete coverage after listing the header's
members, even when bytes after the header belonged to no packed member:
bytes after the last member, gaps between members, or the declared range
of a member that cannot be read. Coverage is now unknown in those cases,
with a limitation giving the unaccounted bytes, their range count and the
first offset. Unpacked members need no packed bytes.
The gap measurement the wxapkg reader used moves to a shared
unaccountedBytes helper that both readers call.
Closes#16588
* feat(artifacts): inspect MetaTrader 5 EX5 program headers and resources
Recognize compiled MQL5 programs by their EX5 magic and inventory them
through inspect_artifact and extract_artifact. Report the program type,
compiler build, copyright/link/version property slots, nonzero header
fields of unknown meaning, and the resource table. List the opaque body
and resource payloads as stored byte ranges; nothing is decrypted,
decompressed or decompiled.
Refs #16495
* feat(artifacts): read MetaTrader 4 EX4 programs with the EX5 layout
EX4 (magic EX-) shares the EX5 header, property slots and resource
table, so both containers become one mql-program format with a
container field. The version slot is 64 bytes and the opaque body
starts at 0x2E8 in both containers; the earlier 0x3A8 header length
counted 192 opaque bytes as part of the version slot. EX4 type code 3
is a library; build is reported under a neutral name because its EX4
meaning is not established.
* fix(artifacts): bound repeated MQL resource ranges and let tar outrank printable magics
Resource records may share one payload range, and each occurrence is
hashed and extractable, so the reader now charges every record against
artifact_limits.expanded_bytes, as the DTBO reader does.
A checksum-valid tar header now runs before the recognizers that match a
printable magic at offset 0. A tar whose first member was named EX-...,
GDPC... or UnityFS was claimed as an MQL program, Godot PCK or UnityFS.
Slot text keeps a leading U+FEFF, which is declared content rather than
an encoding mark.
* fix(artifacts): refuse an invalid tar header only after leading-magic formats
Only a checksum-valid tar header outranks the printable leading magics. A
Godot pack can hold ustar at 257 inside its own content without a valid
tar checksum; refusing that header first rejected the valid pack.
* fix(artifacts): compare MetaTrader resource declarations
A resource's name, kind, record index and unpacked size live in the
resource table, outside the stored payload that content comparison
hashes, so a renamed resource compared as unchanged. Compare them as
the resource's declaration, as tar, ar and UnityFS members do.
* fix(artifacts): keep unreadable MetaTrader resource names unknown in comparison
FIT charged its images against the default expansion budget inside the
structure parser, ignoring a configured artifact_limits.expanded_bytes
and refusing without limit facts. The reader now charges every image,
including image-data links that repeat one range, through a helper the
DTBO reader also uses, and reports the standard expanded_bytes refusal.
The parser's untyped copy is removed.
Classify /<ECSYMBOLS>/ as a symbol table in regular archives so
inspection continues to the following object members.
Carry forward the original fix from #15974 and cover the combination
of an EC symbol table and an LLVM-padded COFF long-name table.
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-authored-by: Shuaixin Huang <3937061056@qq.com>