Program: 33368
Project: 33368
Buggy source:
/** 
 * Split animated GIF to individual images
 * @param is input animated GIF stream
 * @param writer ImageWriter for the output frame
 * @param outputFilePrefix optional prefix for the output image
 * @throws Exception
 * @deprecated use {@link #splitFramesEx2(InputStream,ImageWriter,String) splitFramesEx2} instead.
 */
@Deprecated public static void splitFramesEx(InputStream is,ImageWriter writer,String outputFilePrefix) throws Exception {
  GIFReader reader=new GIFReader();
  ImageType imageType=writer.getImageType();
  BufferedImage bi=reader.getFrameAsBufferedImage(is);
  int logicalScreenWidth=reader.getLogicalScreenWidth();
  int logicalScreenHeight=reader.getLogicalScreenHeight();
  BufferedImage baseImage=new BufferedImage(logicalScreenWidth,logicalScreenHeight,BufferedImage.TYPE_INT_ARGB);
  Graphics2D g=baseImage.createGraphics();
  int frameCount=0;
  String baseFileName=StringUtils.isNullOrEmpty(outputFilePrefix) ? "String_Node_Str" : outputFilePrefix + "String_Node_Str";
  while (bi != null) {
    int image_x=reader.getImageX();
    int image_y=reader.getImageY();
    int imageWidth=bi.getWidth();
    int imageHeight=bi.getHeight();
    Rectangle area=new Rectangle(image_x,image_y,imageWidth,imageHeight);
    BufferedImage backup=new BufferedImage(imageWidth,imageHeight,BufferedImage.TYPE_INT_ARGB);
    backup.setData(baseImage.getData(area));
    g.drawImage(bi,image_x,image_y,null);
    String outFileName=baseFileName + frameCount++;
    FileOutputStream os=new FileOutputStream(outFileName + "String_Node_Str" + imageType.getExtension());
    writer.write(baseImage,os);
    if (reader.getDisposalMethod() == 1 || reader.getDisposalMethod() == 0)     ;
 else     if (reader.getDisposalMethod() == 2) {
      baseImage=new BufferedImage(logicalScreenWidth,logicalScreenHeight,BufferedImage.TYPE_INT_ARGB);
      g=baseImage.createGraphics();
    }
 else     if (reader.getDisposalMethod() == 3) {
      g.drawImage(backup,image_x,image_y,null);
    }
 else {
      baseImage=new BufferedImage(logicalScreenWidth,logicalScreenHeight,BufferedImage.TYPE_INT_ARGB);
      g=baseImage.createGraphics();
    }
    bi=reader.getFrameAsBufferedImage(is);
  }
}

Fixed version (ground truth):
/** 
 * Split animated GIF to individual images
 * @param is input animated GIF stream
 * @param writer ImageWriter for the output frame
 * @param outputFilePrefix optional prefix for the output image
 * @throws Exception
 * @deprecated use {@link #splitFramesEx2(InputStream,ImageWriter,String) splitFramesEx2} instead.
 */
@Deprecated public static void splitFramesEx(InputStream is,ImageWriter writer,String outputFilePrefix) throws Exception {
  GIFReader reader=new GIFReader();
  ImageType imageType=writer.getImageType();
  BufferedImage bi=reader.getFrameAsBufferedImage(is);
  int logicalScreenWidth=reader.getLogicalScreenWidth();
  int logicalScreenHeight=reader.getLogicalScreenHeight();
  BufferedImage baseImage=new BufferedImage(logicalScreenWidth,logicalScreenHeight,BufferedImage.TYPE_INT_ARGB);
  Graphics2D g=baseImage.createGraphics();
  int frameCount=0;
  String baseFileName=StringUtils.isNullOrEmpty(outputFilePrefix) ? "String_Node_Str" : outputFilePrefix + "String_Node_Str";
  while (bi != null) {
    int image_x=reader.getImageX();
    int image_y=reader.getImageY();
    int imageWidth=bi.getWidth();
    int imageHeight=bi.getHeight();
    Rectangle area=new Rectangle(image_x,image_y,imageWidth,imageHeight);
    BufferedImage backup=new BufferedImage(imageWidth,imageHeight,BufferedImage.TYPE_INT_ARGB);
    backup.setData(baseImage.getData(area));
    g.drawImage(bi,image_x,image_y,null);
    String outFileName=baseFileName + frameCount++;
    FileOutputStream os=new FileOutputStream(outFileName + "String_Node_Str" + imageType.getExtension());
    writer.write(baseImage,os);
    if (reader.getDisposalMethod() == 1 || reader.getDisposalMethod() == 0)     ;
 else     if (reader.getDisposalMethod() == 2) {
      Composite oldComposite=g.getComposite();
      g.setComposite(AlphaComposite.Clear);
      g.fillRect(image_x,image_y,imageWidth,imageHeight);
      g.setComposite(oldComposite);
    }
 else     if (reader.getDisposalMethod() == 3) {
      Composite oldComposite=g.getComposite();
      g.setComposite(AlphaComposite.Src);
      g.drawImage(backup,image_x,image_y,null);
      g.setComposite(oldComposite);
    }
 else {
      baseImage=new BufferedImage(logicalScreenWidth,logicalScreenHeight,BufferedImage.TYPE_INT_ARGB);
      g=baseImage.createGraphics();
    }
    bi=reader.getFrameAsBufferedImage(is);
  }
}