Login  Register

Re: bug in Opener.java

Posted by Rasband, Wayne (NIH/NIMH) [E] on Apr 21, 2016; 4:38pm
URL: http://imagej.273.s1.nabble.com/bug-in-Opener-java-tp5016204p5016211.html

On Apr 21, 2016, at 3:16 AM, Ilan <[hidden email]> wrote:

>
> 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.

I get the message

   This does not appear to be a valid
   DICOM file. It does not have the
   characters 'DICM' at offset 128.

when I try to open a zero length file with a “.dcm” extension, which seems like a reasonable error message.

-wayne


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html