-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
DCM incorrect handling of SQ groups in header #5606
Comments
Looking at the example image from #2534 I see that it contains the secondary (smaller) image as (0x0088,0x0200) “Icon Image Sequence”. The primary image on the other hand is outside any Also note that my current checkout at 7.1.0-48-22-g7a3f3f1bd can't read the sample image from #2534 any more, either. Does ImageMagick have a test suite somewhere, a set of images that are expected to get parsed in a certain reproducible way? And speaking of development approach, is there a way on the |
Thanks for the problem report. We can reproduce it and will have a patch to fix it in the GIT main branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ https://imagemagick.org/archive/beta/ by sometime tomorrow. |
Fix some pkglint. Merged Fix DDS file DDPF_LUMINANCE type of data #5452 Commits beta release 9f4d7d5 Removed default quality of 50. d0b8d6e Use the new api of jpeg-xl 0.7.0. 1246eab Set the minimum jpeg-xl version to 0.7.0 67e6c68 Corrected setting the properties that should be set when the image has an alpha channels. 401f580 Adjust num_color_channels when the image is grayscale. 1a2117e Use ReadStrip method when bit depth is higher than 8 (#5597) f95bf0b Added support for reading the resolution of an xcf file (#5549). 7f0348c Minor style change. c50602c Correct distance calculation. c3f5009 Perform ChannelGeometry checks earlier. 7eb960d Corrected version format to be compatible with Ghostscript 10.00.0 (#5618) d5349ca Correct quotes around the password, the old way no longer works with version 10.00.0 of Ghostscript. 82bbf4c Read and use the offset instead of skipping it (#5604). bb4018a Corrected bounds calculation ($5623). 5118534 fix incorrect handling of SQ groups in header @ ImageMagick/ImageMagick#5606 0bc1022 support 1-bit pixels 740ac65 release f032690
ImageMagick version
7.1.0-48-22-g7a3f3f1bd
Operating system
Linux
Operating system, version and so on
Debian Linux 5.18.0-4-amd64
Description
The handling of nested data (value representation SQ) is broken. This leads to
improper image header
errors reported inImageMagick/coders/dcm.c
Line 3261 in 7a3f3f1
Problem 1:
ImageMagick/coders/dcm.c
Line 3268 in 7a3f3f1
info.scale != NULL
. I believe this depends on which attributes have been parsed up to this point, so this can lead to not entering a group which then causes problems when the group is exited inImageMagick/coders/dcm.c
Line 3246 in 7a3f3f1
Problem 2:
I don't see any code which would treat elements with unknown tag and unknown length as nested data encoded. https://dicom.nema.org/medical/dicom/current/output/html/part05.html#sect_6.2.2 writes:
It is unclear to me whether any such data inside an unknown tag should be treated as though it were occurring at top level, or just parsed for length and otherwise discarded. The latter is probably the safer thing to do.
Problem 3:
ImageMagick/coders/dcm.c
Line 3268 in 7a3f3f1
It might make sense to check whether the explicit VR matches what the implicit VR would allow (assuming that the encoding is explicit), to throw an error if there is a VR mismatch, and to just continue with a single consistent VR after that check instead of having some of the code use the explicit and some the implicit one.
Problem 4:
ImageMagick/coders/dcm.c
Lines 3211 to 3217 in 7a3f3f1
I believe it would be better to examine (0x0002,0x0010) transfer syntax information. If that is
1.2.840.10008.1.2
then implicit encoding is used, if it is1.2.840.10008.1.2.1
then it's explicit encoding instead. I'm still looking for the relevant part of the specification to list all these UIDs; the best I have so far is https://dicom.nema.org/medical/dicom/current/output/html/part02.html#sect_B.4.2.1.3.1.2 which makes that distinction.ImageMagick/coders/dcm.c
Lines 3452 to 3457 in 7a3f3f1
type = 1
is also the default it can't use the type to distinguish between implicit and explicit syntax for groups other than 0x0002.Steps to Reproduce
The following code snippet generates test images which I believe should be valid but which currently fail to parse when processed by
identify
orconvert
.Images
No response
The text was updated successfully, but these errors were encountered: