Program: 113410
Project: 113410
Buggy source:
@Override public void startRequest(MRCRequest rq) throws Throwable {
  final setxattrRequest rqArgs=(setxattrRequest)rq.getRequestArgs();
  final VolumeManager vMan=master.getVolumeManager();
  final FileAccessManager faMan=master.getFileAccessManager();
  validateContext(rq);
  Path p=new Path(rqArgs.getVolumeName(),rqArgs.getPath());
  StorageManager sMan=vMan.getStorageManagerByName(p.getComp(0));
  PathResolver res=new PathResolver(sMan,p);
  faMan.checkSearchPermission(sMan,res,rq.getDetails().userId,rq.getDetails().superUser,rq.getDetails().groupIds);
  res.checkIfFileDoesNotExist();
  FileMetadata file=res.getFile();
  AtomicDBUpdate update=sMan.createAtomicDBUpdate(master,rq);
  final String attrKey=rqArgs.getName();
  final byte[] attrVal=rqArgs.hasValueBytesString() ? rqArgs.getValueBytesString().toByteArray() : rqArgs.hasValue() ? rqArgs.getValue().getBytes() : null;
  if (attrKey.startsWith(StorageManager.SYS_ATTR_KEY_PREFIX)) {
    if (master.getConfig().getAdminPassword().length() == 0)     faMan.checkPrivilegedPermissions(sMan,file,rq.getDetails().userId,rq.getDetails().superUser,rq.getDetails().groupIds);
    MRCHelper.setSysAttrValue(sMan,vMan,faMan,res.getParentDirId(),file,attrKey.substring(StorageManager.SYS_ATTR_KEY_PREFIX.length()),new String(attrVal),update);
  }
 else {
    boolean exists=sMan.getXAttr(file.getId(),rq.getDetails().userId,attrKey) != null;
    if (exists && rqArgs.getFlags() == XATTR_FLAGS.XATTR_FLAGS_CREATE.getNumber())     throw new UserException(POSIXErrno.POSIX_ERROR_EEXIST,"String_Node_Str");
    if (!exists && rqArgs.getFlags() == XATTR_FLAGS.XATTR_FLAGS_REPLACE.getNumber())     throw new UserException(POSIXErrno.POSIX_ERROR_ENODATA,"String_Node_Str");
    sMan.setXAttr(file.getId(),rq.getDetails().userId,attrKey,attrVal.length == 0 ? null : attrVal,update);
  }
  int time=(int)(TimeSync.getGlobalTime() / 1000);
  MRCHelper.updateFileTimes(res.getParentDirId(),file,false,true,false,sMan,time,update);
  rq.setResponse(emptyResponse.getDefaultInstance());
  update.execute();
}

Fixed version (ground truth):
@Override public void startRequest(MRCRequest rq) throws Throwable {
  final setxattrRequest rqArgs=(setxattrRequest)rq.getRequestArgs();
  final VolumeManager vMan=master.getVolumeManager();
  final FileAccessManager faMan=master.getFileAccessManager();
  validateContext(rq);
  Path p=new Path(rqArgs.getVolumeName(),rqArgs.getPath());
  StorageManager sMan=vMan.getStorageManagerByName(p.getComp(0));
  PathResolver res=new PathResolver(sMan,p);
  faMan.checkSearchPermission(sMan,res,rq.getDetails().userId,rq.getDetails().superUser,rq.getDetails().groupIds);
  res.checkIfFileDoesNotExist();
  FileMetadata file=res.getFile();
  AtomicDBUpdate update=sMan.createAtomicDBUpdate(master,rq);
  final String attrKey=rqArgs.getName();
  final byte[] attrVal=rqArgs.hasValueBytesString() ? rqArgs.getValueBytesString().toByteArray() : rqArgs.hasValue() ? rqArgs.getValue().getBytes() : null;
  if (attrKey.startsWith(StorageManager.SYS_ATTR_KEY_PREFIX)) {
    boolean privileged=false;
    if (master.getConfig().getAdminPassword().length() > 0 && master.getConfig().getAdminPassword().equals(rq.getDetails().password)) {
      privileged=true;
    }
    faMan.checkPrivilegedPermissions(sMan,file,rq.getDetails().userId,rq.getDetails().superUser || privileged,rq.getDetails().groupIds);
    MRCHelper.setSysAttrValue(sMan,vMan,faMan,res.getParentDirId(),file,attrKey.substring(StorageManager.SYS_ATTR_KEY_PREFIX.length()),new String(attrVal),update);
  }
 else {
    boolean exists=sMan.getXAttr(file.getId(),rq.getDetails().userId,attrKey) != null;
    if (exists && rqArgs.getFlags() == XATTR_FLAGS.XATTR_FLAGS_CREATE.getNumber())     throw new UserException(POSIXErrno.POSIX_ERROR_EEXIST,"String_Node_Str");
    if (!exists && rqArgs.getFlags() == XATTR_FLAGS.XATTR_FLAGS_REPLACE.getNumber())     throw new UserException(POSIXErrno.POSIX_ERROR_ENODATA,"String_Node_Str");
    sMan.setXAttr(file.getId(),rq.getDetails().userId,attrKey,attrVal.length == 0 ? null : attrVal,update);
  }
  int time=(int)(TimeSync.getGlobalTime() / 1000);
  MRCHelper.updateFileTimes(res.getParentDirId(),file,false,true,false,sMan,time,update);
  rq.setResponse(emptyResponse.getDefaultInstance());
  update.execute();
}