Skip to content

Conversation

@AaronGhost
Copy link
Contributor

@AaronGhost AaronGhost commented Nov 12, 2024

At present, "String" lengths are not enforced before writing tags. This can lead to overflows and invalid DICOM.

For example:
(0x0010, 0x1020) -> 1.2345678910111213 (Patient Size - VR: DS) gets written as is and breaks the rest of the DICOM file.

This PR attempts to fix this in most cases by enforcing the maximum length when writing string values.

The DICOM standard makes the distinction between char and bytes for different VR. When specifying maximum bytes, however, the chartset (ascii subset) matches with the number of chars, so we can collect the first chars in both cases.

PN needs special care as the limit is enforced by component.

I double-checked the maximum lengths by VR but it might be worth someone else checking again.

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

Successfully merging this pull request may close these issues.

1 participant