Skip to content

Fix Uncompress decoding of packed numeric arrays - #1666

Merged
axkr merged 1 commit into
axkr:masterfrom
JerryI:codex/uncompress-packed-arrays
Nov 30, 2026
Merged

axkr merged 1 commit into
axkr:masterfrom
JerryI:codex/uncompress-packed-arrays

Conversation

@JerryI

@JerryI JerryI commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Description

Uncompress rejects valid compressed expressions containing packed 16-bit integers (h) or 32-bit reals (l). It also misreads packed 32-bit integers (n) by consuming the rank as a type field and inferring the element width from the remaining stream, which can include subsequent expressions.

Decode each array using its token's fixed element width and preserve the signedness declared by enclosing NumericArray or legacy RawArray expressions. Standalone byte, 16-bit, and 32-bit integer tokens retain their respective unsigned/signed interpretations.

For example, this valid compressed unsigned 16-bit array previously remained unevaluated with Uncompress::corrupt:

Normal[Uncompress[
  "1:eJxTTMoPSmNiYGAo5gESfqW5qUWZyY5FRYmVGSBRGGZgYGSoZ/jPECwIZIbmFWem56WmeOaVpKanFhmaAQD4Mg/B"
]]
(* {{0, 1}, {127, 255}} *)

Testing

  • Added regression coverage for packed numeric arrays, signed/unsigned boundary values, arrays followed by another expression, and truncated payloads.
  • StreamTest: 34 tests passed; the additional Wolfram-syntax compatibility suite: 112 tests passed. No failures, errors, or skips.
  • Clean reactor build/install for the command-line runtime modules and clean console package succeeded.
  • Compared array encodings and signedness with Wolfram. A complete compressed fixture with a 52 MB decompressed payload now loads as a 12-entry association through the rebuilt command-line runner without warnings.
  • git diff --check passed. The full fast/slow suite was not rerun.

@axkr
axkr merged commit e619a2b into axkr:master Nov 30, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants