output: #fixed code
                               @SuppressWarnings("unchecked")
  	@Override
  	protected void init() {
  		super.init();
  		
  		int arrayIndexScale = JvmUtil.arrayIndexScale(elementType);
  		long arrayIndexStartAddress = arrayStartAddress + JvmUtil.arrayBaseOffset(elementType);
  
  		// All index in object pool array header point to allocated objects 
  		for (long l = 0; l < objectCount; l++) {
  			directMemoryService.putLong(
  					arrayIndexStartAddress + (l * arrayIndexScale), 
  					JvmUtil.toJvmAddress((objectsStartAddress + (l * objectSize))));
  		}
  
  		long sourceAddress = offHeapSampleObjectAddress + 4;
  		long copySize = objectSize - 4;
  		// Copy sample object to allocated memory region for each object
  		for (long l = 0; l < objectCount; l++) {
  			long targetAddress = objectsStartAddress + (l * objectSize);
  			directMemoryService.putInt(targetAddress, 0);
  			directMemoryService.copyMemory(sourceAddress, targetAddress + 4, copySize);
  		}
  
  		this.objectArray = (T[]) directMemoryService.getObject(arrayStartAddress);
  	}
input: #vulnerable code 
                               @SuppressWarnings("unchecked")
  	@Override
  	protected void init() {
  		super.init();
  		
  		int arrayHeaderSize = JvmUtil.getArrayHeaderSize();
  		int arrayIndexScale = JvmUtil.arrayIndexScale(elementType);
  		long arrayIndexStartAddress = allocationStartAddress + JvmUtil.arrayBaseOffset(elementType);
  		
  		objectsStartAddress = allocationStartAddress + JvmUtil.sizeOfArray(elementType, objectCount);
  		// Allocated objects must start aligned as address size from start address of allocated address
  		long diffBetweenArrayAndObjectStartAddresses = objectsStartAddress - allocationStartAddress;
  		long addressMod = diffBetweenArrayAndObjectStartAddresses % JvmUtil.OBJECT_ADDRESS_SENSIVITY;
  		if (addressMod != 0) {
  			objectsStartAddress += (JvmUtil.OBJECT_ADDRESS_SENSIVITY - addressMod);
  		}
  		objectsEndAddress = objectsStartAddress + (objectCount * objectSize);
  		
  		// Copy sample array header to object pool array header
  		for (int i = 0; i < arrayHeaderSize; i++) {
  			directMemoryService.putByte(
  					allocationStartAddress + i, 
  					directMemoryService.getByte(sampleArray, i));
  		}
  
  		// Set length of array object pool array
  		JvmUtil.setArrayLength(allocationStartAddress, elementType, (int) objectCount);
  		
  		// All index is object pool array header point to allocated objects 
  		for (long l = 0; l < objectCount; l++) {
  			directMemoryService.putLong(
  					arrayIndexStartAddress + (l * arrayIndexScale), 
  					JvmUtil.toJvmAddress((objectsStartAddress + (l * objectSize))));
  		}
  
  		long sourceAddress = offHeapSampleObjectAddress + 4;
  		long copySize = objectSize - 4;
  		// Copy sample object to allocated memory region for each object
  		for (long l = 0; l < objectCount; l++) {
  			long targetAddress = objectsStartAddress + (l * objectSize);
  			directMemoryService.putInt(targetAddress, 0);
  			directMemoryService.copyMemory(sourceAddress, targetAddress + 4, copySize);
  		}
  
  		this.objectArray = (T[]) directMemoryService.getObject(allocationStartAddress);
  	} 
                              #location 17 
                              #vulnerability type THREAD_SAFETY_VIOLATION