Program: 162711
Project: 162711
Buggy source:
/** 
 * Construct an AltBeacon from a Bluetooth LE packet collected by Android's Bluetooth APIs, including the raw bluetooth device info
 * @param scanData The actual packet bytes
 * @param rssi The measured signal strength of the packet
 * @param device The bluetooth device that was detected
 * @return An instance of an <code>Beacon</code>
 */
@TargetApi(5) public Beacon fromScanData(byte[] scanData,int rssi,BluetoothDevice device){
  AltBeacon beacon=null;
  int startByte=2;
  boolean patternFound=false;
  while (startByte <= 5) {
    if (((int)scanData[startByte + 2] & 0xff) == 0x02 && ((int)scanData[startByte + 3] & 0xff) == 0x15) {
      patternFound=true;
      break;
    }
 else     if (((int)scanData[startByte + 2] & 0xff) == (getMatchingBeaconTypeCode() & 0x00ff) && ((int)scanData[startByte + 3] & 0xff) == (getMatchingBeaconTypeCode() & 0xff00) >> 8) {
      patternFound=true;
      break;
    }
    startByte++;
  }
  if (patternFound == false) {
    if (BeaconManager.debug)     Log.d(TAG,"String_Node_Str" + String.format("String_Node_Str",getMatchingBeaconTypeCode()) + "String_Node_Str"+ bytesToHex(scanData));
    return null;
  }
 else {
    if (BeaconManager.debug)     Log.d(TAG,"String_Node_Str" + String.format("String_Node_Str",getMatchingBeaconTypeCode()) + "String_Node_Str"+ startByte);
  }
  Integer id2=(scanData[startByte + 20] & 0xff) * 0x100 + (scanData[startByte + 21] & 0xff);
  Integer id3=(scanData[startByte + 22] & 0xff) * 0x100 + (scanData[startByte + 23] & 0xff);
  int txPower=0;
  if (scanData.length > startByte + 24) {
    txPower=(int)scanData[startByte + 24];
  }
  int manData=0;
  if (scanData.length > startByte + 25) {
    manData=(int)(scanData[startByte + 25] & 0xff);
  }
  int beaconTypeCode=(scanData[startByte + 3] & 0xff) * 0x100 + (scanData[startByte + 2] & 0xff);
  byte[] id1Bytes=new byte[16];
  System.arraycopy(scanData,startByte + 4,id1Bytes,0,16);
  String hexString=bytesToHex(id1Bytes);
  StringBuilder sb=new StringBuilder();
  sb.append(hexString.substring(0,8));
  sb.append("String_Node_Str");
  sb.append(hexString.substring(8,12));
  sb.append("String_Node_Str");
  sb.append(hexString.substring(12,16));
  sb.append("String_Node_Str");
  sb.append(hexString.substring(16,20));
  sb.append("String_Node_Str");
  sb.append(hexString.substring(20,32));
  String id1=sb.toString();
  if (BeaconManager.debug)   Log.d(TAG,"String_Node_Str" + id1 + "String_Node_Str"+ hexString);
  if (device != null) {
    beacon.mBluetoothAddress=device.getAddress();
  }
  String macAddress=null;
  if (device != null) {
    macAddress=device.getAddress();
  }
  AltBeacon altBeacon=new AltBeacon(id1,id2.toString(),id3.toString(),txPower,rssi,beaconTypeCode,manData,macAddress);
  altBeacon.mManData=manData;
  return altBeacon;
}

Fixed version (ground truth):
/** 
 * Construct an AltBeacon from a Bluetooth LE packet collected by Android's Bluetooth APIs, including the raw bluetooth device info
 * @param scanData The actual packet bytes
 * @param rssi The measured signal strength of the packet
 * @param device The bluetooth device that was detected
 * @return An instance of an <code>Beacon</code>
 */
@TargetApi(5) public Beacon fromScanData(byte[] scanData,int rssi,BluetoothDevice device){
  int startByte=2;
  boolean patternFound=false;
  while (startByte <= 5) {
    if (((int)scanData[startByte + 2] & 0xff) == 0x02 && ((int)scanData[startByte + 3] & 0xff) == 0x15) {
      patternFound=true;
      break;
    }
 else     if (((int)scanData[startByte + 2] & 0xff) == (getMatchingBeaconTypeCode() & 0x00ff) && ((int)scanData[startByte + 3] & 0xff) == (getMatchingBeaconTypeCode() & 0xff00) >> 8) {
      patternFound=true;
      break;
    }
    startByte++;
  }
  if (patternFound == false) {
    if (BeaconManager.debug)     Log.d(TAG,"String_Node_Str" + String.format("String_Node_Str",getMatchingBeaconTypeCode()) + "String_Node_Str"+ bytesToHex(scanData));
    return null;
  }
 else {
    if (BeaconManager.debug)     Log.d(TAG,"String_Node_Str" + String.format("String_Node_Str",getMatchingBeaconTypeCode()) + "String_Node_Str"+ startByte);
  }
  Integer id2=(scanData[startByte + 20] & 0xff) * 0x100 + (scanData[startByte + 21] & 0xff);
  Integer id3=(scanData[startByte + 22] & 0xff) * 0x100 + (scanData[startByte + 23] & 0xff);
  int txPower=0;
  if (scanData.length > startByte + 24) {
    txPower=(int)scanData[startByte + 24];
  }
  int manData=0;
  if (scanData.length > startByte + 25) {
    manData=(int)(scanData[startByte + 25] & 0xff);
  }
  int beaconTypeCode=(scanData[startByte + 3] & 0xff) * 0x100 + (scanData[startByte + 2] & 0xff);
  byte[] id1Bytes=new byte[16];
  System.arraycopy(scanData,startByte + 4,id1Bytes,0,16);
  String hexString=bytesToHex(id1Bytes);
  StringBuilder sb=new StringBuilder();
  sb.append(hexString.substring(0,8));
  sb.append("String_Node_Str");
  sb.append(hexString.substring(8,12));
  sb.append("String_Node_Str");
  sb.append(hexString.substring(12,16));
  sb.append("String_Node_Str");
  sb.append(hexString.substring(16,20));
  sb.append("String_Node_Str");
  sb.append(hexString.substring(20,32));
  String id1=sb.toString();
  if (BeaconManager.debug)   Log.d(TAG,"String_Node_Str" + id1 + "String_Node_Str"+ hexString);
  String macAddress=null;
  if (device != null) {
    macAddress=device.getAddress();
  }
  AltBeacon altBeacon=new AltBeacon(id1,id2.toString(),id3.toString(),txPower,rssi,beaconTypeCode,manData,macAddress);
  altBeacon.mManData=manData;
  if (device != null) {
    altBeacon.mBluetoothAddress=device.getAddress();
  }
  return altBeacon;
}