Skip to content

Conversation

@rouault
Copy link
Member

@rouault rouault commented Nov 20, 2025

For label boxes, the spec is pretty explicit about that: "Label strings are not null-terminated" Cf
https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-T.801-200208-S!!PDF-E&type=items "M.11.13 Label box", page 197

For XML boxes, nothing explicit, but in the absence of a statement, null-terminating byte doesn't seem necessary. Furthermore jpylyzer documentation at https://jpylyzer.openpreservation.org/doc/latest/userManual.html has a 'nullxml' option because 'Apparently some old versions of the Kakadu demo applications would erroneously add a null-byte to embedded XML'.

Fixes https://lists.osgeo.org/pipermail/gdal-dev/2025-November/061180.html

Reported-by: Brad Hards [email protected]

@rouault rouault added the backport release/3.12 Backport to 3.12 branch label Nov 20, 2025
@rouault rouault force-pushed the jp2_remove_nul_characer branch from dc9fd80 to 3f7625a Compare November 20, 2025 02:27
@rouault rouault force-pushed the jp2_remove_nul_characer branch 4 times, most recently from 1952c43 to c582208 Compare November 20, 2025 03:07
… ' and 'xml ' boxes

For label boxes, the spec is pretty explicit about that: "Label strings are not null-terminated"
Cf
https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-T.801-200208-S!!PDF-E&type=items
"M.11.13 Label box", page 197

For XML boxes, nothing explicit, but in the absence of a statement,
null-terminating byte doesn't seem necessary. Furthermore jpylyzer
documentation at https://jpylyzer.openpreservation.org/doc/latest/userManual.html
has a 'nullxml' option because 'Apparently some old versions of the Kakadu demo
applications would erroneously add a null-byte to embedded XML'.

Fixes https://lists.osgeo.org/pipermail/gdal-dev/2025-November/061180.html

Reported-by: Brad Hards <[email protected]>
@rouault rouault force-pushed the jp2_remove_nul_characer branch from c582208 to b1530f9 Compare November 20, 2025 03:12
@bradh
Copy link
Contributor

bradh commented Nov 20, 2025

For XML boxes, nothing explicit, but in the absence of a statement, null-terminating byte doesn't seem necessary.

ISO/IEC 15444-16:2024 Section I.7.1 says that DATA shall contain a well-formed XML document, and NUL doesn't appear to be valid in XML. So I think this is correct.

I built this branch, generated a test file, and things seem better.

Thanks for the quick fix.

@rouault rouault merged commit e65e528 into OSGeo:master Nov 20, 2025
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport release/3.12 Backport to 3.12 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants