DICOM codec crashes while reading

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
purrquay
Posts: 12
Joined: 2011-03-23T17:09:45-07:00
Authentication code: 8675308

DICOM codec crashes while reading

Post by purrquay »

When reading certain DICOM files (of which this is an example), the codec crashes in 2 places, both due to dereferencing a null pointer:

The following is an excerpt from dcm.c from line 3253:

Code: Select all

          case 0x1050:
          {
            /*
              Visible pixel range: center.
            */
            window_center=StringToLong((char *) data);
            break;
          }
          case 0x1051:
          {
            /*
              Visible pixel range: width.
            */
            window_width=StringToUnsignedLong((char *) data);
            break;
          }
The fix is simple, and does not seem to have side effects:

Code: Select all

          case 0x1050:
          {
            /*
              Visible pixel range: center.
            */
            if (data != NULL)
              window_center=StringToLong((char *) data);
            break;
          }
          case 0x1051:
          {
            /*
              Visible pixel range: width.
            */
            if (data != NULL)
              window_width=StringToUnsignedLong((char *) data);
            break;
          }
Post Reply