Skip to content

Modify: xmlReadFile() at IccProfileXml.cpp:877 & IccMpeXml.cpp:2400 #735

@xsscx

Description

@xsscx

Maintainer Summary

2026-03-27 00:03:32 UTC

iccDEV v2.3.1.5+85663e4 (ASAN+UBSAN)

Profile: v5.00 NamedColorClass (nmcl)
Spectral PCS: 31-step biSpectral reflectance (400-700nm, BiSpectral 300-700nm, 41 steps)
Profile ID: 681d53eca55a99d11051f605e7a105c0

Observations

  • The XML to Binary to XML round-trip is NOT semantically reversible for calculator-heavy profiles
  • Original numerical intent/precision is preserved in float16
  • Binary encoding according to ICC.2-2023 specification
  • Data loss (calculator ops, labels) is by design -- the binary format stores evaluated values, not source expressions
  • The libxml2 10MB limit is a Bug
    • Error: "xmlSAX2Characters: huge text node"
      • IccProfileXml.cpp:877 xmlReadFile(szFilename, NULL, 0)
      • IccMpeXml.cpp:2400 xmlReadFile(file.c_str(), NULL, 0)
      • Neither passes XML_PARSE_HUGE (0x80000) flag
  • Potential observer label loss bug (enum mapping)
    • iccToXml maps it back to "Unknown observer"
    • (x-bar, y-bar, z-bar) is preserved

Profile Conversion Results

Numbers: PRESERVED (float32 precision, max rel err <5e-08)
Headers: PRESERVED (with expected normalization)
Tags: PRESERVED (6 tags, structurally equivalent)
Text: PRESERVED (copyright, description identical)
Spectral: PRESERVED (observer + illuminant + white point)
Calc Logic: LOST (93,600 operations evaluated to float16 values)
Observer: LOST ("CIE 1931 standard..." returned "Unknown observer")
NaN/INF: LOST (111,489 leaving 79 survivors after evaluation)
Format: CHANGED (tab to space, 8 to 12 decimal, line wrapping)

TODO

  • Change to xmlReadFile(szFilename, NULL, XML_PARSE_HUGE)
  • Research potential observer label loss bug (enum mapping)

Originally posted by @xsscx in #524

  • Missing XML_PARSE_NOENT and XML_PARSE_NONET options

Metadata

Metadata

Assignees

Labels

TriagedMaintainer indicates triaged status and ready for developer handoff

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions