Skip to content

Kernel forms: a partial field name with a period is written, and ISO 32000 forbids it #772

Backlog

Description

@Tim81

Why

ISO 32000-1, 12.7.3.2 (ISO 32000-2, 12.7.4.2): "a partial name shall not contain a PERIOD character", because the period separates the parts of a fully qualified name.

Measured on origin/main b2791ba, no claim, PdfDocument.AddTextField(page, "a.b", rect, "v") then Save: the file holds /T (a.b) on the widget, and qpdf --check is clean. No call refuses the name; AddTextField checks only that it is not empty and not already used. A reader reads the field as the child b of a field a that does not exist.

Sweep: the name reaches /T in AddTextField, AddCheckBox, AddChoiceField, AddRadioButtonGroup and AddPushButton (PdfDocument.cs, AcroFormBuilder.cs: five Set(new PdfName("T"), TextString(field.Name))). The two other field writers use fixed names: Signature1 (PdfDocument.PrepareForSigning) and DocTimeStamp1 (ArchiveTimestampBuilder). Layout, Barcodes, Fonts.Standard14, Cli, Reader and Conformance create no field (git grep for the five Add methods and AcroForm over their src folders finds none outside Conformance, which reads).

Proposal

Refuse a name that holds a period at the Add* call, with ArgumentException (ParamName name) naming the character, as the same methods already refuse an empty or repeated name. The 2.3.3 file was invalid, so the refusal is allowed. Document it on each member: "A name with a period is refused.", and the reason.

Acceptance

  • The skipped test ConformanceAuditG6Tests.Iso32000_1_12_7_3_2_APartialFieldNameHasNoPeriod runs and passes, and the pin Iso32000_1_12_7_3_2_PinsTodayAPeriodInAPartialFieldNameIsWritten is replaced by a test of each of the five refusals.
  • A name with no period still saves with the same bytes.
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