Program: 61661
Project: 61661
Buggy source:
/** 
 * Reads one Tag from the stream with optional resolving (= reading tag content)
 * @param timelined
 * @param level
 * @param pos
 * @param resolve
 * @param parallel
 * @param skipUnusualTags
 * @return Tag or null when End tag
 * @throws IOException
 * @throws java.lang.InterruptedException
 */
public Tag readTag(Timelined timelined,int level,long pos,boolean resolve,boolean parallel,boolean skipUnusualTags) throws IOException, InterruptedException {
  int tagIDTagLength=readUI16("String_Node_Str");
  int tagID=(tagIDTagLength) >> 6;
  logger.log(Level.INFO,"String_Node_Str",new Object[]{tagID,pos});
  long tagLength=(tagIDTagLength & 0x003F);
  boolean readLong=false;
  if (tagLength == 0x3f) {
    tagLength=readSI32("String_Node_Str");
    readLong=true;
  }
  int headerLength=readLong ? 6 : 2;
  SWFInputStream tagDataStream=getLimitedStream((int)tagLength);
  int available=available();
  if (tagLength > available) {
    tagLength=available;
  }
  ByteArrayRange dataRange=new ByteArrayRange(swf.uncompressedData,(int)pos,(int)(tagLength + headerLength));
  skipBytes(tagLength);
  TagStub tagStub=new TagStub(swf,tagID,"String_Node_Str",dataRange,tagDataStream);
  tagStub.forceWriteAsLong=readLong;
  Tag ret=tagStub;
  if (tagDataStream.dumpInfo == null && dumpInfo != null) {
    dumpInfo.tagToResolve=tagStub;
  }
  if (resolve) {
    DumpInfo di=dumpInfo;
    try {
      ret=resolveTag(tagStub,level,parallel,skipUnusualTags);
    }
 catch (    EndOfStreamException ex) {
      tagDataStream.endDumpLevelUntil(di);
      logger.log(Level.SEVERE,"String_Node_Str" + timelined.toString(),ex);
    }
    if (Configuration.debugMode.get()) {
      byte[] data=ret.getOriginalData().getRangeData();
      byte[] dataNew=ret.getData();
      int ignoreFirst=0;
      for (int i=0; i < data.length; i++) {
        if (i >= dataNew.length) {
          break;
        }
        if (dataNew[i] != data[i]) {
          if (ignoreFirst > 0) {
            ignoreFirst--;
            continue;
          }
          String e="String_Node_Str" + ret.toString() + "String_Node_Str";
          for (int j=i - 10; j <= i + 5; j++) {
            while (j < 0) {
              j++;
            }
            if (j >= data.length) {
              break;
            }
            if (j >= dataNew.length) {
              break;
            }
            if (j >= i) {
              e+=(Long.toHexString(data[j] & 0xff) + "String_Node_Str" + Long.toHexString(dataNew[j] & 0xff)+ "String_Node_Str");
            }
 else {
              e+=(Long.toHexString(data[j] & 0xff) + "String_Node_Str");
            }
          }
          logger.fine(e);
        }
      }
    }
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Reads one Tag from the stream with optional resolving (= reading tag content)
 * @param timelined
 * @param level
 * @param pos
 * @param resolve
 * @param parallel
 * @param skipUnusualTags
 * @return Tag or null when End tag
 * @throws IOException
 * @throws java.lang.InterruptedException
 */
public Tag readTag(Timelined timelined,int level,long pos,boolean resolve,boolean parallel,boolean skipUnusualTags) throws IOException, InterruptedException {
  int tagIDTagLength=readUI16("String_Node_Str");
  int tagID=(tagIDTagLength) >> 6;
  logger.log(Level.INFO,"String_Node_Str",new Object[]{tagID,pos});
  long tagLength=(tagIDTagLength & 0x003F);
  boolean readLong=false;
  if (tagLength == 0x3f) {
    tagLength=readSI32("String_Node_Str");
    readLong=true;
  }
  int headerLength=readLong ? 6 : 2;
  SWFInputStream tagDataStream=getLimitedStream((int)tagLength);
  int available=available();
  if (tagLength > available) {
    tagLength=available;
  }
  ByteArrayRange dataRange=new ByteArrayRange(swf.uncompressedData,(int)pos,(int)(tagLength + headerLength));
  skipBytes(tagLength);
  TagStub tagStub=new TagStub(swf,tagID,"String_Node_Str",dataRange,tagDataStream);
  tagStub.forceWriteAsLong=readLong;
  Tag ret=tagStub;
  if (tagDataStream.dumpInfo == null && dumpInfo != null) {
    dumpInfo.tagToResolve=tagStub;
  }
  if (resolve) {
    DumpInfo di=dumpInfo;
    try {
      ret=resolveTag(tagStub,level,parallel,skipUnusualTags);
    }
 catch (    Exception ex) {
      tagDataStream.endDumpLevelUntil(di);
      logger.log(Level.SEVERE,"String_Node_Str" + timelined.toString(),ex);
    }
    if (Configuration.debugMode.get()) {
      byte[] data=ret.getOriginalData().getRangeData();
      byte[] dataNew=ret.getData();
      int ignoreFirst=0;
      for (int i=0; i < data.length; i++) {
        if (i >= dataNew.length) {
          break;
        }
        if (dataNew[i] != data[i]) {
          if (ignoreFirst > 0) {
            ignoreFirst--;
            continue;
          }
          String e="String_Node_Str" + ret.toString() + "String_Node_Str";
          for (int j=i - 10; j <= i + 5; j++) {
            while (j < 0) {
              j++;
            }
            if (j >= data.length) {
              break;
            }
            if (j >= dataNew.length) {
              break;
            }
            if (j >= i) {
              e+=(Long.toHexString(data[j] & 0xff) + "String_Node_Str" + Long.toHexString(dataNew[j] & 0xff)+ "String_Node_Str");
            }
 else {
              e+=(Long.toHexString(data[j] & 0xff) + "String_Node_Str");
            }
          }
          logger.fine(e);
        }
      }
    }
  }
  return ret;
}