Program: 61447
Project: 61447
Buggy source:
public Tag importImage(ImageTag it,byte[] newData,int tagType) throws IOException {
  if (newData[0] == 'B' && newData[1] == 'M') {
    BufferedImage b=ImageHelper.read(newData);
    ByteArrayOutputStream baos=new ByteArrayOutputStream();
    ImageHelper.write(b,ImageFormat.PNG,baos);
    newData=baos.toByteArray();
  }
  if (tagType == 0) {
    if (it instanceof DefineBitsTag) {
      tagType=DefineBitsTag.ID;
    }
 else {
      tagType=it.getId();
    }
  }
  if (it.getId() == tagType) {
    it.setImage(newData);
  }
 else {
    SWF swf=it.getSwf();
    ImageTag imageTag;
    ByteArrayRange range=it.getOriginalRange();
    int characterId=it.getCharacterId();
switch (tagType) {
case DefineBitsJPEG2Tag.ID:
{
        imageTag=new DefineBitsJPEG2Tag(swf,range,characterId,newData);
        break;
      }
case DefineBitsJPEG3Tag.ID:
{
      imageTag=new DefineBitsJPEG3Tag(swf,range,characterId,newData);
      break;
    }
case DefineBitsJPEG4Tag.ID:
{
    imageTag=new DefineBitsJPEG4Tag(swf,range,characterId,newData);
    break;
  }
case DefineBitsLosslessTag.ID:
{
  DefineBitsLosslessTag losslessTag=new DefineBitsLosslessTag(swf,range,characterId);
  losslessTag.setImage(newData);
  imageTag=losslessTag;
  break;
}
case DefineBitsLossless2Tag.ID:
{
DefineBitsLossless2Tag lossless2Tag=new DefineBitsLossless2Tag(swf,range,characterId);
lossless2Tag.setImage(newData);
imageTag=lossless2Tag;
break;
}
default :
throw new Error("String_Node_Str");
}
imageTag.setModified(true);
swf.replaceTag(it,imageTag);
swf.updateCharacters();
return imageTag;
}
return null;
}

Fixed version (ground truth):
public Tag importImage(ImageTag it,byte[] newData,int tagType) throws IOException {
  if (newData[0] == 'B' && newData[1] == 'M') {
    BufferedImage b=ImageHelper.read(newData);
    ByteArrayOutputStream baos=new ByteArrayOutputStream();
    ImageHelper.write(b,ImageFormat.PNG,baos);
    newData=baos.toByteArray();
  }
  if (tagType == 0) {
    if (it instanceof DefineBitsTag) {
      tagType=DefineBitsJPEG2Tag.ID;
    }
 else {
      tagType=it.getId();
    }
  }
  if (it.getId() == tagType) {
    it.setImage(newData);
  }
 else {
    SWF swf=it.getSwf();
    ImageTag imageTag;
    ByteArrayRange range=it.getOriginalRange();
    int characterId=it.getCharacterId();
switch (tagType) {
case DefineBitsJPEG2Tag.ID:
{
        imageTag=new DefineBitsJPEG2Tag(swf,range,characterId,newData);
        break;
      }
case DefineBitsJPEG3Tag.ID:
{
      imageTag=new DefineBitsJPEG3Tag(swf,range,characterId,newData);
      break;
    }
case DefineBitsJPEG4Tag.ID:
{
    imageTag=new DefineBitsJPEG4Tag(swf,range,characterId,newData);
    break;
  }
case DefineBitsLosslessTag.ID:
{
  DefineBitsLosslessTag losslessTag=new DefineBitsLosslessTag(swf,range,characterId);
  losslessTag.setImage(newData);
  imageTag=losslessTag;
  break;
}
case DefineBitsLossless2Tag.ID:
{
DefineBitsLossless2Tag lossless2Tag=new DefineBitsLossless2Tag(swf,range,characterId);
lossless2Tag.setImage(newData);
imageTag=lossless2Tag;
break;
}
default :
throw new Error("String_Node_Str");
}
imageTag.setModified(true);
swf.replaceTag(it,imageTag);
swf.updateCharacters();
return imageTag;
}
return null;
}