Program: 184974
Project: 184974
Buggy source:
/** 
 * In order to determine whether the bookmark set has changed since the last time we did a backup, we store the following bits of info in the state file after a backup: 1. the size of the flattened bookmark file 2. the CRC32 of that file 3. the agent version number [relevant following an OTA] After we flatten the bookmarks file here in onBackup, we compare its metrics with the values from the saved state.  If they match, it means the bookmarks didn't really change and we don't need to send the data. (If they don't match, of course, then they've changed and we do indeed send the new flattened file to be backed up.)
 */
@Override public void onBackup(ParcelFileDescriptor oldState,BackupDataOutput data,ParcelFileDescriptor newState) throws IOException {
  long savedFileSize=-1;
  long savedCrc=-1;
  int savedVersion=-1;
  DataInputStream in=new DataInputStream(new FileInputStream(oldState.getFileDescriptor()));
  try {
    savedFileSize=in.readLong();
    savedCrc=in.readLong();
    savedVersion=in.readInt();
  }
 catch (  EOFException e) {
  }
  File tmpfile=File.createTempFile("String_Node_Str",null,getCacheDir());
  try {
    FileOutputStream outfstream=new FileOutputStream(tmpfile);
    long newCrc=buildBookmarkFile(outfstream);
    outfstream.close();
    if ((savedVersion != BACKUP_AGENT_VERSION) || (newCrc != savedCrc) || (tmpfile.length() != savedFileSize)) {
      copyFileToBackup(BOOKMARK_KEY,tmpfile,data);
    }
    writeBackupState(tmpfile.length(),newCrc,newState);
  }
  finally {
    tmpfile.delete();
  }
}

Fixed version (ground truth):
/** 
 * In order to determine whether the bookmark set has changed since the last time we did a backup, we store the following bits of info in the state file after a backup: 1. the size of the flattened bookmark file 2. the CRC32 of that file 3. the agent version number [relevant following an OTA] After we flatten the bookmarks file here in onBackup, we compare its metrics with the values from the saved state.  If they match, it means the bookmarks didn't really change and we don't need to send the data. (If they don't match, of course, then they've changed and we do indeed send the new flattened file to be backed up.)
 */
@Override public void onBackup(ParcelFileDescriptor oldState,BackupDataOutput data,ParcelFileDescriptor newState) throws IOException {
  long savedFileSize=-1;
  long savedCrc=-1;
  int savedVersion=-1;
  DataInputStream in=new DataInputStream(new FileInputStream(oldState.getFileDescriptor()));
  try {
    savedFileSize=in.readLong();
    savedCrc=in.readLong();
    savedVersion=in.readInt();
  }
 catch (  EOFException e) {
  }
 finally {
    if (in != null) {
      in.close();
    }
  }
  File tmpfile=File.createTempFile("String_Node_Str",null,getCacheDir());
  try {
    FileOutputStream outfstream=new FileOutputStream(tmpfile);
    long newCrc=buildBookmarkFile(outfstream);
    outfstream.close();
    if ((savedVersion != BACKUP_AGENT_VERSION) || (newCrc != savedCrc) || (tmpfile.length() != savedFileSize)) {
      copyFileToBackup(BOOKMARK_KEY,tmpfile,data);
    }
    writeBackupState(tmpfile.length(),newCrc,newState);
  }
  finally {
    tmpfile.delete();
  }
}