Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors for segments with size > 2147483647 bytes #16

Open
lblatchford opened this issue Feb 2, 2023 · 2 comments
Open

Errors for segments with size > 2147483647 bytes #16

lblatchford opened this issue Feb 2, 2023 · 2 comments

Comments

@lblatchford
Copy link

When attempting to parse a NITF 2.1 file with a large image segment the following error occurred "Parse Error: Failed to populate ImageSegment[1]. Cause Parse Error: Cannot convert '2516582400' from Long type to Int (Value '2516582400' is out of range for xs:int"

The PayloadLength is xs:int. When the schema file is changed to make PayloadLength xs:unsignedLong, another error occurs:

"Failed to convert: Parse Error: Failed to populate ImageSegment[1]. Cause: Parse Error: Choice dispatch branch failed: List( Parse Error: Length for xs:hexBinary exceeds maximum of 2147483647 bytes: 2516582400".

I believe the xs:hexBinary type should have an unbounded maximum, so the reason for this error is unclear.

The test data would have to be approved for release by DISA. The test data request form and information about the files to be requested can be provided upon request.

@stevedlawrence
Copy link
Member

Under the hood, Daffodli uses a Java array to store hex binary bytes which has a maximum size of 231-1 bytes (i.e. 2 GB).

If hexBinary larger than 2GB is needed, it's probably better to use the Daffodil Binary Large Object extension. To use this, you can change the type from xs:hexBinary to xs:anyUri and add the property dfdlx:objectKind="bytes". This will cause Daffodil to write the raw bytes to a temporary file and put the path to that file in the infoset instead of hex binary. This is much more efficient compared xs:hexBinary and has a much larger size limit, I believe 263-1 bits which is something like 10^18 bytes.

@lblatchford
Copy link
Author

lblatchford commented Feb 2, 2023 via email

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

No branches or pull requests

2 participants