Commit Graph
1309 Commits
Author SHA1 Message Date
FredApps 4e3ff581b8 Merge branch 'main' into sonar/analysis-scope 2026-11-10 20:40:52 +01:00
Afloat 675a7d7724 Recognize required volatile modifiers in CLI signatures (R3.12) (#1580)
The .NET signature reader called a type volatile when any of its first eight custom modifiers contained IsVolatile, so optional modifiers, a Custom.IsVolatile type and IsVolatileExtra all counted, and a real required marker after eight other modifiers was missed. A type is now volatile only when a required modifier is exactly System.Runtime.CompilerServices.IsVolatile, checked across every modifier.
2026-11-11 02:40:34 +07:00
FredApps 5419e8e013 Merge branch 'main' into sonar/analysis-scope 2026-11-10 20:39:55 +01:00
Cr 5cb423e814 Decode Swift function type attributes (R3.12) (#1582)
A Swift function type can carry markers after its parameters and result, and the demangler read only Ya (async): Yb (@Sendable), Yc (a global actor such as @Swift.MainActor), YA (@isolated(any)) and YK (typed throws) were reported invalid, the first failure for 19,217 symbols in macOS and Xcode system binaries, mostly closures and functions that take a @Sendable or @MainActor closure. Function types now keep these attributes and print them as swift-demangle does, with typed throws as throws(E).
2026-11-11 02:39:45 +07:00
FredApps 0488575bf6 Merge branch 'main' into sonar/analysis-scope 2026-11-10 20:37:05 +01:00
Cr 0f2f4d7d2d Decode Swift key path getter and setter symbols (R3.12) (#1579)
A Swift symbol ending in TK is a key path's getter and Tk its setter, with the property or subscript the path reads under the type it starts from. The demangler reported them as "unsupported thunk or specialization". They now read as swift-demangle prints them: key path getter (or setter) for the property with its type, then the base type. A global, module or bare name in either place is still refused.
2026-11-11 02:36:34 +07:00
FredApps 4815705755 Merge branch 'main' into sonar/analysis-scope 2026-11-10 20:34:16 +01:00
Cr 3fbd47a6b3 Name Swift noncanonical specialized metadata symbols (R3.12) (#1578)
Three Swift metadata kinds read with the wrong phrase: MN said "type metadata for" where swift-demangle prints "noncanonical specialized generic type metadata for", Mj said "module descriptor" for what is an "opaque type descriptor accessor key for" a type, and Mz said "type metadata heap reference for" for the "flag for loading of canonical specialized generic type metadata for". They now read as swift-demangle prints them.
2026-11-11 02:34:09 +07:00
FredApps 47ff685d85 Merge branch 'main' into sonar/analysis-scope 2026-11-10 20:32:24 +01:00
Afloat 5120403cb8 Read requested ranges from stored Unity bundle blocks (R3.12) (#1576)
A small metadata or object read from a Unity bundle read and copied every block it touched in full, stored blocks included, so a valid stored block over the 512 MiB read limit made ordinary bundle and object listing fail even for a 496-byte member, and smaller stored blocks allocated bytes nobody asked for. For a stored block the reader now checks that its stored and uncompressed sizes agree and reads just the requested part from the file. Compressed blocks keep the existing decompress-and-cache path, and the 256 MiB per-request limit stays.
2026-11-11 02:32:09 +07:00
FredApps 3c642f6e64 Merge branch 'main' into sonar/analysis-scope 2026-11-10 20:29:37 +01:00
Afloat ffaef8564d Apply global PAX attributes to TAR members (R3.12) (#1570)
The tar reader handled per-member PAX extensions but ignored global ones, so later members could get the wrong path, link target or stored size, and a global size override left the next header at the wrong offset. Global path, link and size attributes are now kept until a later global record replaces or deletes them, applied after per-member PAX values and before GNU long names or the plain header. Each metadata header is read at its own stored length, inherited sizes must be unsigned decimals, and inherited sparse attributes are reported as unsupported. Copies of inherited names share a 64 MiB budget; engine installs refuse an archive that exceeds it before writing anything.
2026-11-11 02:29:14 +07:00
FredApps 08a88e3baf Merge branch 'main' into sonar/analysis-scope 2026-11-10 20:24:06 +01:00
Afloat 1fc942a04f Recover files from big-endian cramfs images (R3.12) (#1575)
The firmware scanner recognised both cramfs byte orders, but the filesystem reader refused big-endian images before reading anything; their inodes also pack the size, name length and offset into different bit positions, so the magic alone wasn't enough. The byte order is now taken from the magic and used for inode modes, sizes, the name-length and offset bitfields (size in the upper 24 bits, name length in the upper 6, offset in the lower 26) and the compressed-block pointers. Directory traversal keeps the same span checks and recovery budgets.
2026-11-11 02:23:22 +07:00
FredApps 4ab1a26727 Merge branch 'main' into sonar/analysis-scope 2026-11-10 20:23:09 +01:00
Afloat 36ff598a44 Bound expanded PYZ identities across archive listings (R3.12) (#1567)
PYZ name limits applied to the names stored in its table, but each nested entry also repeats the surrounding CArchive member path, so a short table under a long shared prefix could hold far more path text than its size suggests: a valid 5 MB archive made with PyInstaller 6.16 kept 146 MB of paths for 40,001 entries. Expanded module, package, resource and unknown-member paths, and namespace-package names, now share an 8 MiB budget per listing, across all nested PYZ members and in standalone PYZ listings. Each complete path is checked before it's built; when the budget runs out, the entries read so far are kept and the listing is marked truncated.
2026-11-11 02:22:32 +07:00
Afloat e957c1d8cb Use version-specific Python headers for extracted PYZ code (R3.12) (#1563)
Code taken out of a PyInstaller PYZ archive was always given a 16-byte .pyc header, although Python 2.5 to 3.2 use 8 bytes and 3.3 to 3.6 use 12, so older code had extra zeros between the header and the marshalled code and couldn't be read at its own header boundary. The output limit reserved 16 bytes too, refusing an exact limit for 2.7 or 3.6 code. Wrapping, header parsing and the PYZ output limit now share one header-size lookup from the release table, and unknown magic numbers keep the 16-byte form. Tests cover standalone and nested PYZ archives, modules and packages, and exact limits.
2026-11-11 02:22:26 +07:00
Afloat 893134c342 Bound expanded ASAR paths and say when an extraction is incomplete (#1558)
ASAR entry and depth limits didn't bound the combined size of expanded paths: a compact directory tree could repeat one long parent prefix across thousands of short names, and a valid 1.5 MB archive kept 145 MB of path text. Expanded entry paths and rejected names now share an 8 MiB budget, checked before each path is built; when it runs out, the entries read so far are kept and the listing is marked truncated. core_archive_extract used to ignore a truncated listing and call the extraction complete; for ASAR and ZIP it now extracts what was listed, adds a limitation that the listing was cut short, and marks coverage partial with no claimed total. The JavaScript app analysis carries the same flag.
2026-11-11 02:22:14 +07:00
FredApps 3b92cedf4e Merge branch 'main' into sonar/analysis-scope 2026-11-10 20:10:10 +01:00
Cr be003e1224 Decode Swift outlined value operation symbols (R3.12) (#1572)
The Swift compiler writes outlined value operations (a copy, move, destroy or enum tag operation for one type) as the type followed by WO and a letter. The demangler read WO as an unsupported witness kind, so these were invalid: 28,456 symbols in macOS and Xcode system binaries, 28,391 of which now decode. Each letter reads as swift-demangle prints it, such as outlined destroy of T, including the indexed enum operations and merged ones.
2026-11-11 02:09:21 +07:00
FredApps c4b96ad81c Merge branch 'main' into sonar/analysis-scope 2026-11-10 20:05:31 +01:00
Cr 80c96e205b Decode Swift opaque result types (R3.12) (#1569)
A Swift function, variable or subscript that returns some P writes that result as Qr (a later opaque type in a tuple is QR with an index), and elsewhere the same opaque type is named by its declaration with QO, generic arguments and Qo. The demangler knew only Qz and Qy, so all of these were invalid ("unsupported associated type"), the first reason for 29,707 symbols in macOS and Xcode system binaries. They now read as swift-demangle prints them.
2026-11-11 02:05:02 +07:00
FredApps d9d121da28 Merge branch 'main' into sonar/analysis-scope 2026-11-10 20:04:33 +01:00
Afloat 6f0092949c Bound retained PE import and export names (R3.12) (#1571)
PE import descriptors and export aliases can point at the same strings again and again, and the row limits didn't bound the text kept: a 526 KB import fixture and a 1.2 MB export fixture each ran out of memory under a 128 MiB limit, and export indexing decoded every name before deciding which rows fit. Retained names (library names, import names, export aliases and forwarders) now draw on a 64 MiB budget, one shared by the normal, delay-load and bound import directories and one for exports. Export names are decoded only for rows that are kept. When the budget runs out, the rows read so far and the declared export count are kept, and the table is marked truncated with a warning.
2026-11-11 02:04:00 +07:00
Afloat 71d97a481b Merge repeated JAR entry sections before checking file digests (R3.12) (#1568)
A JAR manifest may describe one file in several sections, whose attributes merge with later values replacing earlier ones. The integrity check verified each section on its own, so a valid signed manifest could report the same file as both matching and mismatching, and the ZIP entry was read more than once. Digest attributes are now merged by exact entry path before checking: a later section replaces only the attributes it has, the existing digest preference applies, and each file is checked and counted once. Attribute names still match case-insensitively and file paths case-sensitively.
2026-11-11 02:03:54 +07:00
FredApps c1098cb5b8 Merge branch 'main' into sonar/analysis-scope 2026-11-10 19:57:08 +01:00
Afloat 3839858154 Verify RSA-PSS signatures using their declared parameters (R3.12) (#1565)
Certificate verification treated every RSASSA-PSS algorithm identifier as SHA-256 with a digest-sized salt, and CMS verification took its hash from the separate digest field, so a signature could verify despite conflicting hashes, salt lengths or key restrictions, while genuine SHA-384 signatures and other valid salt lengths were refused. The complete PSS parameters are now read (hash, MGF1 hash, salt length and trailer field) with the RFC 4055 defaults, and incomplete, repeated, out-of-order or unsupported parameters are refused with a reason. Verification uses the declared parameters, checks them against an RSA-PSS key's restrictions, and requires a certificate's signed and outer parameters to agree.
2026-11-11 01:56:55 +07:00
Cr f2c7a3ce00 Decode Swift lazy witness table cache variable symbols (R3.12) (#1564)
A Swift symbol ending in WL is the cache variable of a lazy protocol witness table and names a type and the conformance it's used with, like the lazy accessor Wl. The demangler took one operand for it and reported these symbols invalid ("N nodes left after decoding"). They now read as swift-demangle prints them: lazy protocol witness table cache variable for type T and conformance C. Wl and WL share one reader.
2026-11-11 01:56:49 +07:00
Afloat 1e962a5142 List Objective-C classes and categories once per address (R3.12) (#1559)
The Mach-O reader walks both the ordinary and the non-lazy Objective-C registration lists, and the compiler puts non-lazy classes and categories in both, so they appeared twice with their methods repeated. Each class and category is now listed once by its decoded address, in first-seen order. Two different definitions with the same name stay separate.
2026-11-11 01:56:40 +07:00
FredApps a50a6ba72d Merge branch 'main' into sonar/analysis-scope 2026-11-10 19:56:11 +01:00
Afloat d777e0e1c4 Recover zero-filled cramfs hole blocks (R3.12) (#1566)
A cramfs hole has no compressed bytes: its end pointer repeats the previous block boundary. The reader handed that empty span to the zlib decoder and lost an otherwise valid file, which affected all-zero files, holes between data blocks and zero-filled tails. A block whose end equals its start now reads as zeros, sized to the rest of the file for the last block, within the existing per-file and total size budgets. Backward and out-of-image pointers are still corrupt, and compressed blocks must still decode to their exact length.
2026-11-11 01:55:51 +07:00
FredApps 709a75986d Merge branch 'main' into sonar/analysis-scope 2026-11-10 19:48:46 +01:00
Afloat 7b0b082219 Read module formats in current Node SEA archives (R3.12) (#1562)
Node.js 25.7 writes a module-format byte after the exec-argument extension in a single-executable-application blob header. The reader knew only the three older layouts, so new CommonJS and ESM blobs both failed with "no known Node blob layout accounts for every byte", although their script paths, code, assets and arguments were all there, one byte further on. The new layout is now read, with its two defined values (CommonJS and module), and the listing reports module_format (null for older layouts, which don't store it). Complete-layout checks and the refusal of ambiguous blobs are unchanged. Tests use blobs made with the official Node.js 25.7 binary from small original scripts.
2026-11-11 01:48:09 +07:00
FredApps 1ee2dfc877 Merge branch 'main' into sonar/analysis-scope 2026-11-10 19:46:54 +01:00
Afloat 3595efb4c2 Decode Unity ETC1 RGB textures (R3.9) (#1561)
Unity textures in format 34 (ETC_RGB4) were unsupported, so a readable asset whose first mip used ETC1 couldn't produce a picture. A new ETC1 decoder reads the 4x4 RGB blocks, covering individual and differential base colours, both subblock orientations, every modifier table and ETC1's column-major selector bits, and format 34 now uses it. First-mip sizing, the output pixel limit and edge cropping apply as for the other block formats. Truncated blocks and invalid differential colours are refused.
2026-11-11 01:46:32 +07:00
FredApps 5e5601be9b Merge branch 'main' into sonar/analysis-scope 2026-11-10 19:43:11 +01:00
Afloat 935a079ff2 Account for copied Swift substitution nodes (R3.12) (#1560)
The Swift demangler limited the nodes it copied out of its substitution table, but saving a new substitution cloned the whole tree without charging that budget, so nested nominal and optional types in a small symbol could keep many overlapping trees; reusing a substitution also cloned it before checking the repeat count and budget. Saving a substitution now spends the node budget before cloning, and a reuse borrows the stored tree, checks the count and cost, then copies only what's needed. Ordinary nested types and repeated references still decode, and an oversized expansion is reported invalid with "symbol expands too much".
2026-11-11 01:42:20 +07:00
FredApps c9cbe70237 Merge branch 'main' into sonar/analysis-scope 2026-11-10 19:37:35 +01:00
Afloat 9e393e42f2 Disclose WebAssembly metadata limits in both tool views (R3.12) (#1557)
After the WebAssembly reader began leaving out derived metadata once its byte budget is spent, formats_wasm_module_show still said lists stop at 100,000 entries even when the byte budget ran out much earlier, and its summary view left out the reader's truncated flag. The limitation now says lists or derived metadata are incomplete and points to the warnings for which limit was reached, and the summary view includes truncated as the complete view already did.
2026-11-11 01:36:50 +07:00
FredApps 583f41b5f3 Merge branch 'main' into sonar/analysis-scope 2026-11-10 19:29:14 +01:00
Afloat febd46bf30 Decode Unity textures with unsigned 16-bit channels (R3.9) (#1516)
Unity RG32, RGB48 and RGBA64 textures (formats 72–74), with two, three or four unsigned 16-bit channels, showed as unknown formats and couldn't be previewed or exported. They're now decoded to RGBA8 with the same rounding as R16: missing blue is zero, missing alpha opaque, and Unity's row order and first-mip limits apply. Tests cover the byte widths, channel order, rounding boundaries, alpha, short pixel data and serialized Texture2D fixtures for all three.
2026-11-11 01:29:05 +07:00
FredApps 8eb67c191d Merge branch 'main' into sonar/analysis-scope 2026-11-10 19:24:37 +01:00
Afloat 19f30cf82a Require definition or reference handles in CLI type signatures (R3.12) (#1556)
CLI signatures accepted a TypeSpec handle after CLASS or VALUETYPE, including as the base of a generic instantiation, which made up types such as Container<int, string><int> and could expand a recursive signature again and again. Those positions now take only TypeDef or TypeRef handles, as ECMA-335 requires. TypeSpec handles are still read for standalone type names and custom modifiers, where they're allowed.
2026-11-11 01:24:21 +07:00
Afloat 94835fbb9e Validate CMS signed attributes before reporting authentication (R3.12) (#1536)
The CMS reader took the first value of each signed attribute without checking its type or count, let a repeated required attribute overwrite the first, never compared contentType with the encapsulated content, and accepted the readable start of a malformed attribute list, so a genuine signature over such attributes could report authenticated for Mach-O CMS and a valid detached JAR signature. Signed attributes now need a complete list with exactly one messageDigest OCTET STRING and one contentType OID that matches the encapsulated type. When they don't, the signature stays readable, with its certificates, signer and algorithms, and is reported as not authenticated with the reason. Unknown well-formed attributes are kept.
2026-11-11 01:24:15 +07:00
FredApps a635ce6709 Merge branch 'main' into sonar/analysis-scope 2026-11-10 19:18:10 +01:00
Afloat 76b52be3f5 Keep fixed PE versions inside their declared values (R3.12) (#1555)
The PE version reader found the VS_FIXEDFILEINFO signature in the surrounding resource and then read the version fields without checking that the whole fixed record sat inside the node's declared value, so bytes from a neighbouring child, or from past the node, could supply a file or product version the node didn't contain. The fixed record is now read only from the node's declared binary value, which must be binary, hold all 52 bytes and end inside the node. Version strings in StringFileInfo are still read when no valid fixed record exists.
2026-11-11 01:17:48 +07:00
Afloat 90ec857f61 Bound retained Go function names when pclntab references are shared (R3.12) (#1554)
A Go function table can reuse one name offset for many records, and the function and per-name limits still let a small table hold hundreds of megabytes of names: 100,000 references to one 4 KB name in a real ELF ran out of memory under a 128 MiB limit. Kept function names now draw on a byte budget (64 MiB, or three times the table's extent if larger) in every table layout. When it runs out, the functions read so far keep their exact addresses, the list is marked truncated with a warning naming the limit, and the declared count is kept. Repeated names that fit stay complete.
2026-11-11 01:10:56 +07:00
Cr 18f3e8c63c Decode Swift concurrency standard types (R3.12) (#1553)
In a Swift symbol, Sc and one more letter is a short spelling of a concurrency type, as Si is Swift.Int: ScT is Task, ScG is TaskGroup, ScA is the Actor protocol, and so on. The demangler read Sc and stopped, so every symbol that contained one was invalid ("concurrency standard types are not supported"). Each now reads in module Swift as swift-demangle prints it, for example Swift.Task<(), Swift.Never>, and a letter with no type is still refused.
2026-11-11 01:10:49 +07:00
Cr d1aa3c1388 Decode Swift operator function names (R3.12) (#1551)
A Swift function named by an operator (==, +, a prefix -, a postfix ...) is mangled as its name, then o and a fixity letter, with each operator character written as a letter. The demangler stopped at the o ("unsupported operator 'o'"), so every operator function, and every witness, thunk and descriptor built around one, read as invalid: 34,816 of 2.36 million symbols in macOS and Xcode system binaries, 28,898 of which now decode. Operators now read as swift-demangle prints them, such as static Swift.Int.% infix(Swift.Int, Swift.Int) -> Swift.Int.
2026-11-11 01:09:45 +07:00
Afloat bcede83fc6 Apply Android package type offsets to resource identities (R3.12) (#1547)
Android resource packages with a nonzero typeIdOffset published the unshifted type byte, so a package with offset 3 and local string type 1 reported 0x7f010000 instead of 0x7f040000, and packages sharing a package ID could seem to define the same resources. The offset is now read from package headers of 288 bytes or more and added, checked, to public type and resource IDs, while type names are still looked up by the local ID. Legacy 284-byte headers keep an offset of zero. An oversized offset, or a shifted type outside the one-byte field, marks the result partial with a warning and leaves valid sibling types readable.
2026-11-11 01:09:39 +07:00