Skip to content

Kernel: JpxImageLoader reads no Rsiz, so a codestream outside the JPX baseline feature set is written #770

In review

Description

@Tim81

Why

ISO 32000-1 and -2, 7.4.9: data used in PDF image XObjects shall be limited to the JPX baseline set of features. JpxImageLoader reads the SIZ marker for size, channel count and the first component's depth, and never the Rsiz field that says which capabilities the codestream uses.

Measured on the audit branch (b2791ba plus tests): JpxCodestream(16, 16, 3, 7, 0x8000), a SIZ whose Rsiz has the Part 2 bit set, saved through LayoutImage.FromBytes. The image is written with /Filter /JPXDecode and the codestream's bytes unchanged inside a JP2 file (Iso32000_2_7_4_9_PinsTodayAPartTwoCodestreamIsPassedThrough). veraPDF 1.30.4 has no rule for the feature set.

What the baseline set contains is defined by the JPX specification that 7.4.9 refers to and is not held in docs/iso, so the exact Rsiz values to accept need that text.

Sweep: image data is passed through only by the loaders in VellumPdf.Kernel/Images; JBIG2 and CCITT do not carry a feature profile, and the JPEG loader's frame-type question is in #763.

Proposal

Read Rsiz and refuse (InvalidDataException) a codestream that sets the Part 2 bit, or that uses a profile the baseline set excludes once the specification text is checked.

Acceptance

Iso32000_2_7_4_9_AJpxCodestreamOutsideTheBaselineFeatureSetIsRefused loses its skip and passes; the pin is rewritten. A codestream inside the baseline set writes the same bytes as before.

Activity

  1. added
    bug
    on Nov 29, 2026
  2. added 2 commits that reference this issue on Nov 29, 2026
  3. Tim81 commented on Nov 29, 2026

    @Tim81
    OwnerAuthor

    The tests that pin and accept this issue were renamed during the audit's review rounds; the acceptance section above names earlier ones. Current names, all in ConformanceAuditG4Tests (tests/VellumPdf.Kernel.Tests/ConformanceAuditG4Tests.*.cs, PR #765). A pin passes today and is rewritten by the fix; an accept test is skipped now and loses its skip with the fix; a keep test passes before and after.

    • Pin: Iso32000_2_7_4_9_PinsTodayAPartTwoCodestreamIsPassedThrough (Rsiz 0x8000)
    • Accept (skipped): Iso32000_2_7_4_9_AJpxCodestreamOutsideTheBaselineFeatureSetIsRefused
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions