Login  Register

bug in Opener.java

Posted by Ilan on Apr 21, 2016; 7:16am
URL: http://imagej.273.s1.nabble.com/bug-in-Opener-java-tp5016204.html

There is
public int getFileType(String path)
which has a bug. The dicom check reads as

                 // DICOM ("DICM" at offset 128)
                if (buf[128]==68 && buf[129]==73 && buf[130]==67 && buf[131]==77 || name.endsWith(".dcm")) {
                        return DICOM;
                }

The problem is there can be nonsense at buf 128 to 131 and the file will still be marked as dicom just because of its extension. I happened to have a file of zero length which nicely passed itself off as valid dicom.

Ilan