Program: 109162
Project: 109162
Buggy source:
/** 
 * Converts input array of Java ARGB values representing an image of width x height resolution to native OpenGL format (RGBA on big endian, BGRA on little endian). It also rearranges the elements in the array so that the image is flipped vertically.
 */
protected static void javaToNativeARGB(int[] pixels,int width,int height){
  int index=0;
  int yindex=(height - 1) * width;
  for (int y=0; y < height / 2; y++) {
    if (BIG_ENDIAN) {
      for (int x=0; x < width; x++) {
        int temp=pixels[index];
        pixels[index]=((pixels[yindex] >> 24) & 0xff) | ((pixels[yindex] << 8) & 0xffffff00);
        pixels[yindex]=((temp >> 24) & 0xff) | ((temp << 8) & 0xffffff00);
        index++;
        yindex++;
      }
    }
 else {
      for (int x=0; x < width; x++) {
        int temp=pixels[index];
        pixels[index]=(pixels[yindex] & 0xff000000) | ((pixels[yindex] << 16) & 0xff0000) | (pixels[yindex] & 0xff00)| ((pixels[yindex] >> 16) & 0xff);
        pixels[yindex]=(pixels[yindex] & 0xff000000) | ((temp << 16) & 0xff0000) | (temp & 0xff00)| ((temp >> 16) & 0xff);
        index++;
        yindex++;
      }
    }
    yindex-=width * 2;
  }
  if ((height % 2) == 1) {
    index=(height / 2) * width;
    if (BIG_ENDIAN) {
      for (int x=0; x < width; x++) {
        pixels[index]=((pixels[index] >> 24) & 0xff) | ((pixels[index] << 8) & 0xffffff00);
        index++;
      }
    }
 else {
      for (int x=0; x < width; x++) {
        pixels[index]=(pixels[index] & 0xff000000) | ((pixels[index] << 16) & 0xff0000) | (pixels[index] & 0xff00)| ((pixels[index] >> 16) & 0xff);
        index++;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Converts input array of Java ARGB values representing an image of width x height resolution to native OpenGL format (RGBA on big endian, BGRA on little endian). It also rearranges the elements in the array so that the image is flipped vertically.
 */
protected static void javaToNativeARGB(int[] pixels,int width,int height){
  int index=0;
  int yindex=(height - 1) * width;
  for (int y=0; y < height / 2; y++) {
    if (BIG_ENDIAN) {
      for (int x=0; x < width; x++) {
        int temp=pixels[index];
        pixels[index]=((pixels[yindex] >> 24) & 0xff) | ((pixels[yindex] << 8) & 0xffffff00);
        pixels[yindex]=((temp >> 24) & 0xff) | ((temp << 8) & 0xffffff00);
        index++;
        yindex++;
      }
    }
 else {
      for (int x=0; x < width; x++) {
        int temp=pixels[index];
        pixels[index]=(pixels[yindex] & 0xff000000) | ((pixels[yindex] << 16) & 0xff0000) | (pixels[yindex] & 0xff00)| ((pixels[yindex] >> 16) & 0xff);
        pixels[yindex]=(temp & 0xff000000) | ((temp << 16) & 0xff0000) | (temp & 0xff00)| ((temp >> 16) & 0xff);
        index++;
        yindex++;
      }
    }
    yindex-=width * 2;
  }
  if ((height % 2) == 1) {
    index=(height / 2) * width;
    if (BIG_ENDIAN) {
      for (int x=0; x < width; x++) {
        pixels[index]=((pixels[index] >> 24) & 0xff) | ((pixels[index] << 8) & 0xffffff00);
        index++;
      }
    }
 else {
      for (int x=0; x < width; x++) {
        pixels[index]=(pixels[index] & 0xff000000) | ((pixels[index] << 16) & 0xff0000) | (pixels[index] & 0xff00)| ((pixels[index] >> 16) & 0xff);
        index++;
      }
    }
  }
}