Program: 22766
Project: 22766
Buggy source:
public int performBackup(PackageInfo packageInfo,ParcelFileDescriptor data){
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + packageInfo.packageName);
  File packageDir=new File(mDataDir,packageInfo.packageName);
  packageDir.mkdirs();
  BackupDataInput changeSet=new BackupDataInput(data.getFileDescriptor());
  try {
    int bufSize=512;
    byte[] buf=new byte[bufSize];
    while (changeSet.readNextHeader()) {
      String key=changeSet.getKey();
      String base64Key=new String(Base64.encode(key.getBytes()));
      File entityFile=new File(packageDir,base64Key);
      int dataSize=changeSet.getDataSize();
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + key + "String_Node_Str"+ dataSize+ "String_Node_Str"+ base64Key);
      if (dataSize >= 0) {
        FileOutputStream entity=new FileOutputStream(entityFile);
        if (dataSize > bufSize) {
          bufSize=dataSize;
          buf=new byte[bufSize];
        }
        changeSet.readEntityData(buf,0,dataSize);
        if (DEBUG)         Log.v(TAG,"String_Node_Str" + dataSize);
        try {
          entity.write(buf,0,dataSize);
        }
 catch (        IOException e) {
          Log.e(TAG,"String_Node_Str" + entityFile.getAbsolutePath());
          return BackupConstants.TRANSPORT_ERROR;
        }
 finally {
          entity.close();
        }
      }
 else {
        entityFile.delete();
      }
    }
    return BackupConstants.TRANSPORT_OK;
  }
 catch (  IOException e) {
    Log.v(TAG,"String_Node_Str",e);
    return BackupConstants.TRANSPORT_ERROR;
  }
}

Fixed version (ground truth):
public int performBackup(PackageInfo packageInfo,ParcelFileDescriptor data){
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + packageInfo.packageName);
  File packageDir=new File(mDataDir,packageInfo.packageName);
  packageDir.mkdirs();
  BackupDataInput changeSet=new BackupDataInput(data.getFileDescriptor());
  try {
    int bufSize=512;
    byte[] buf=new byte[bufSize];
    while (changeSet.readNextHeader()) {
      String key=changeSet.getKey();
      String base64Key=new String(Base64.encode(key.getBytes()));
      File entityFile=new File(packageDir,base64Key);
      int dataSize=changeSet.getDataSize();
      if (DEBUG)       Log.v(TAG,"String_Node_Str" + key + "String_Node_Str"+ dataSize+ "String_Node_Str"+ base64Key);
      if (dataSize >= 0) {
        if (entityFile.exists()) {
          entityFile.delete();
        }
        FileOutputStream entity=new FileOutputStream(entityFile);
        if (dataSize > bufSize) {
          bufSize=dataSize;
          buf=new byte[bufSize];
        }
        changeSet.readEntityData(buf,0,dataSize);
        if (DEBUG)         Log.v(TAG,"String_Node_Str" + dataSize);
        try {
          entity.write(buf,0,dataSize);
        }
 catch (        IOException e) {
          Log.e(TAG,"String_Node_Str" + entityFile.getAbsolutePath());
          return BackupConstants.TRANSPORT_ERROR;
        }
 finally {
          entity.close();
        }
      }
 else {
        entityFile.delete();
      }
    }
    return BackupConstants.TRANSPORT_OK;
  }
 catch (  IOException e) {
    Log.v(TAG,"String_Node_Str",e);
    return BackupConstants.TRANSPORT_ERROR;
  }
}