Program: 92487
Project: 92487
Buggy source:
/** 
 * Uses the provided BinaryReader to load the necessary values from the data  file in to the Dataset. Stream mode only loads the essential information  such as file headers.
 * @param reader BinaryReader to use for reading data in to the dataset.
 * @param dataSet The dataset object to load in to.
 * @return Stream Dataset object that has just been written to.
 * @throws IOException 
 */
static void load(Dataset dataSet) throws IOException {
  BinaryReader reader=null;
  try {
    reader=dataSet.pool.getReader();
    reader.setPos(0);
    CommonFactory.loadHeader(dataSet,reader);
    dataSet.strings=new StreamVariableList<AsciiString>(dataSet,reader,new AsciiStringFactory(),DetectionConstants.STRINGS_CACHE_SIZE);
    MemoryFixedList<Component> components=null;
switch (dataSet.versionEnum) {
case PatternV31:
      components=new MemoryFixedList<Component>(dataSet,reader,new ComponentFactoryV31());
    break;
case PatternV32:
  components=new MemoryFixedList<Component>(dataSet,reader,new ComponentFactoryV32());
break;
}
dataSet.components=components;
MemoryFixedList<Map> maps=new MemoryFixedList<Map>(dataSet,reader,new MapFactory());
dataSet.maps=maps;
PropertiesList properties=new PropertiesList(dataSet,reader,new PropertyFactory());
dataSet.properties=properties;
dataSet.values=new FixedCacheList<Value>(dataSet,reader,new ValueFactory(),DetectionConstants.VALUES_CACHE_SIZE);
dataSet.profiles=new StreamVariableList<Profile>(dataSet,reader,new ProfileStreamFactory(dataSet.pool),DetectionConstants.PROFILE_CACHE_SIZE);
switch (dataSet.versionEnum) {
case PatternV31:
dataSet.signatures=new FixedCacheList<Signature>(dataSet,reader,new SignatureFactoryV31(dataSet),DetectionConstants.SIGNATURES_CACHE_SIZE);
case PatternV32:
dataSet.signatures=new FixedCacheList<Signature>(dataSet,reader,new SignatureFactoryV32(dataSet),DetectionConstants.SIGNATURES_CACHE_SIZE);
dataSet.signatureNodeOffsets=new StreamFixedList<IntegerEntity>(dataSet,reader,new IntegerEntityFactory());
dataSet.nodeRankedSignatureIndexes=new StreamFixedList<IntegerEntity>(dataSet,reader,new IntegerEntityFactory());
}
dataSet.rankedSignatureIndexes=new FixedCacheList<IntegerEntity>(dataSet,reader,new IntegerEntityFactory(),DetectionConstants.RANKED_SIGNATURE_CACHE_SIZE);
switch (dataSet.versionEnum) {
case PatternV31:
dataSet.nodes=new StreamVariableList<Node>(dataSet,reader,new NodeStreamFactoryV31(dataSet.pool),DetectionConstants.NODES_CACHE_SIZE);
break;
case PatternV32:
dataSet.nodes=new StreamVariableList<Node>(dataSet,reader,new NodeStreamFactoryV32(dataSet.pool),DetectionConstants.NODES_CACHE_SIZE);
break;
}
MemoryFixedList<Node> rootNodes=new MemoryFixedList<Node>(dataSet,reader,new RootNodeFactory());
dataSet.rootNodes=rootNodes;
MemoryFixedList<ProfileOffset> profileOffsets=new MemoryFixedList<ProfileOffset>(dataSet,reader,new ProfileOffsetFactory());
dataSet.profileOffsets=profileOffsets;
reader.setPos(components.header.getStartPosition());
components.read(reader);
reader.setPos(maps.header.getStartPosition());
maps.read(reader);
reader.setPos(properties.header.getStartPosition());
properties.read(reader);
reader.setPos(rootNodes.header.getStartPosition());
rootNodes.read(reader);
reader.setPos(profileOffsets.header.getStartPosition());
profileOffsets.read(reader);
}
  finally {
if (reader != null) dataSet.pool.release(reader);
}
}

Fixed version (ground truth):
/** 
 * Uses the provided BinaryReader to load the necessary values from the data  file in to the Dataset. Stream mode only loads the essential information  such as file headers.
 * @param reader BinaryReader to use for reading data in to the dataset.
 * @param dataSet The dataset object to load in to.
 * @return Stream Dataset object that has just been written to.
 * @throws IOException 
 */
static void load(Dataset dataSet) throws IOException {
  BinaryReader reader=null;
  try {
    reader=dataSet.pool.getReader();
    reader.setPos(0);
    CommonFactory.loadHeader(dataSet,reader);
    dataSet.strings=new StreamVariableList<AsciiString>(dataSet,reader,new AsciiStringFactory(),DetectionConstants.STRINGS_CACHE_SIZE);
    MemoryFixedList<Component> components=null;
switch (dataSet.versionEnum) {
case PatternV31:
      components=new MemoryFixedList<Component>(dataSet,reader,new ComponentFactoryV31());
    break;
case PatternV32:
  components=new MemoryFixedList<Component>(dataSet,reader,new ComponentFactoryV32());
break;
}
dataSet.components=components;
MemoryFixedList<Map> maps=new MemoryFixedList<Map>(dataSet,reader,new MapFactory());
dataSet.maps=maps;
PropertiesList properties=new PropertiesList(dataSet,reader,new PropertyFactory());
dataSet.properties=properties;
dataSet.values=new FixedCacheList<Value>(dataSet,reader,new ValueFactory(),DetectionConstants.VALUES_CACHE_SIZE);
dataSet.profiles=new StreamVariableList<Profile>(dataSet,reader,new ProfileStreamFactory(dataSet.pool),DetectionConstants.PROFILE_CACHE_SIZE);
switch (dataSet.versionEnum) {
case PatternV31:
dataSet.signatures=new FixedCacheList<Signature>(dataSet,reader,new SignatureFactoryV31(dataSet),DetectionConstants.SIGNATURES_CACHE_SIZE);
break;
case PatternV32:
dataSet.signatures=new FixedCacheList<Signature>(dataSet,reader,new SignatureFactoryV32(dataSet),DetectionConstants.SIGNATURES_CACHE_SIZE);
dataSet.signatureNodeOffsets=new StreamFixedList<IntegerEntity>(dataSet,reader,new IntegerEntityFactory());
dataSet.nodeRankedSignatureIndexes=new StreamFixedList<IntegerEntity>(dataSet,reader,new IntegerEntityFactory());
break;
}
dataSet.rankedSignatureIndexes=new FixedCacheList<IntegerEntity>(dataSet,reader,new IntegerEntityFactory(),DetectionConstants.RANKED_SIGNATURE_CACHE_SIZE);
switch (dataSet.versionEnum) {
case PatternV31:
dataSet.nodes=new StreamVariableList<Node>(dataSet,reader,new NodeStreamFactoryV31(dataSet.pool),DetectionConstants.NODES_CACHE_SIZE);
break;
case PatternV32:
dataSet.nodes=new StreamVariableList<Node>(dataSet,reader,new NodeStreamFactoryV32(dataSet.pool),DetectionConstants.NODES_CACHE_SIZE);
break;
}
MemoryFixedList<Node> rootNodes=new MemoryFixedList<Node>(dataSet,reader,new RootNodeFactory());
dataSet.rootNodes=rootNodes;
MemoryFixedList<ProfileOffset> profileOffsets=new MemoryFixedList<ProfileOffset>(dataSet,reader,new ProfileOffsetFactory());
dataSet.profileOffsets=profileOffsets;
reader.setPos(components.header.getStartPosition());
components.read(reader);
reader.setPos(maps.header.getStartPosition());
maps.read(reader);
reader.setPos(properties.header.getStartPosition());
properties.read(reader);
reader.setPos(rootNodes.header.getStartPosition());
rootNodes.read(reader);
reader.setPos(profileOffsets.header.getStartPosition());
profileOffsets.read(reader);
}
  finally {
if (reader != null) dataSet.pool.release(reader);
}
}