Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6359303

ImageReader throws an exception on certain GIF files

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 7
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Introduced In Version:
    • Resolved In Build:
      b10
    • CPU:
      x86
    • OS:
      linux
    • Verification:
      Verified

      Description

      FULL PRODUCT VERSION :
      java version "1.5.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
      Java HotSpot(TM) Server VM (build 1.5.0-b64, mixed mode)

      (confirmed also in JDK 1.4.2_04 and 1.4.2_06)

      ADDITIONAL OS VERSION INFORMATION :
      Linux XX 2.4.24 #7 SMP XX i686 GNU/Linux

      (confirmed also on Mac OSX)

      A DESCRIPTION OF THE PROBLEM :
      The ImageIO ImageReader throws an exception in the .read() method on some types of GIF images.

      A sample file can be found at

      ftp://ftp.berlios.de/pub/digilib/babylon_funny.gif

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Invoke ImageReader.read() on a special GIF image (e.g. with the provided test program)

      A sample image file can be found at

      ftp://ftp.berlios.de/pub/digilib/babylon_funny.gif



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      the reader loads the image
      ACTUAL -
      the reader throws an exception

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      javax.imageio.IIOException: Unexpected block type 51!
              at com.sun.imageio.plugins.gif.GIFImageReader.readMetadata(GIFImageReader.java:721)
              at com.sun.imageio.plugins.gif.GIFImageReader.read(GIFImageReader.java:954)
              at javax.imageio.ImageReader.read(ImageReader.java:919)
              at ReadImgTest.main(ReadImgTest.java:43)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.*;
      import java.util.*;
      import java.awt.image.*;
      import javax.imageio.*;
      import javax.imageio.stream.*;

      public class IIO {

      public static void main(String[] args) {
      File f = new File(args[0]);
      ImageInputStream iis = null;
      try {
      iis = new FileImageInputStream(f);
      } catch (FileNotFoundException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
      } catch (IOException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
      }
      Iterator i = ImageIO.getImageReaders(iis);
      ImageReader r = (ImageReader) i.next();
      r.setInput(iis);
      try {
      BufferedImage img = r.read(0);
      } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      }
      }
      }


      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bae Andrew Brygin
                Reporter:
                prr Philip Race
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: