Program: 35047
Project: 35047
Buggy source:
@Override public ValidateResult validate(AliasTransaction tx){
  Alias alias=tx.getTxData();
  Account account=accountService.getAccount(alias.getAddress()).getData();
  if (null == account) {
    return ValidateResult.getFailedResult(this.getClass().getName(),AccountErrorCode.ACCOUNT_NOT_EXIST);
  }
  if (alias.getAlias().equals(account.getAlias())) {
    return ValidateResult.getFailedResult(this.getClass().getName(),AccountErrorCode.ALIAS_EXIST);
  }
  if (!Address.validAddress(alias.getAddress())) {
    return ValidateResult.getFailedResult(this.getClass().getName(),AccountErrorCode.ADDRESS_ERROR);
  }
  if (!StringUtils.validAlias(alias.getAlias())) {
    return ValidateResult.getFailedResult(this.getClass().getName(),AccountErrorCode.ALIAS_ERROR);
  }
  AliasPo aliasPo=alisaStorageService.getAlias(alias.getAlias()).getData();
  if (aliasPo != null) {
    return ValidateResult.getFailedResult(this.getClass().getName(),AccountErrorCode.ALIAS_EXIST);
  }
  if (tx.isFreeOfFee()) {
    return ValidateResult.getFailedResult(alias.getClass().getName(),TransactionErrorCode.FEE_NOT_RIGHT);
  }
  CoinData coinData=tx.getCoinData();
  if (null == coinData) {
    return ValidateResult.getFailedResult(this.getClass().getName(),TransactionErrorCode.FEE_NOT_RIGHT);
  }
  Na realFee=tx.getFee();
  Na fee=TransactionFeeCalculator.getFee(tx.size());
  if (realFee.isLessThan(fee.add(AccountConstant.ALIAS_NA))) {
    return ValidateResult.getFailedResult(this.getClass().getName(),TransactionErrorCode.FEE_NOT_RIGHT);
  }
  P2PKHScriptSig sig=new P2PKHScriptSig();
  try {
    sig.parse(tx.getScriptSig());
  }
 catch (  NulsException e) {
    Log.error(e);
    return ValidateResult.getFailedResult(this.getClass().getName(),e.getMessage());
  }
  if (!Arrays.equals(tx.getTxData().getAddress(),AddressTool.getAddress(sig.getPublicKey()))) {
    ValidateResult result=ValidateResult.getFailedResult(this.getClass().getName(),"String_Node_Str");
    result.setLevel(SeverityLevelEnum.FLAGRANT_FOUL);
    return result;
  }
  return ValidateResult.getSuccessResult();
}

Fixed version (ground truth):
@Override public ValidateResult validate(AliasTransaction tx){
  Alias alias=tx.getTxData();
  Alias aliasDb=aliasService.getAlias(alias.getAlias());
  if (null != aliasDb) {
    return ValidateResult.getFailedResult(this.getClass().getName(),AccountErrorCode.ALIAS_EXIST);
  }
  List<Account> list=accountService.getAccountList().getData();
  for (  Account account : list) {
    if (alias.getAlias().equals(account.getAlias())) {
      return ValidateResult.getFailedResult(this.getClass().getName(),AccountErrorCode.ALIAS_EXIST);
    }
  }
  if (!Address.validAddress(alias.getAddress())) {
    return ValidateResult.getFailedResult(this.getClass().getName(),AccountErrorCode.ADDRESS_ERROR);
  }
  if (!StringUtils.validAlias(alias.getAlias())) {
    return ValidateResult.getFailedResult(this.getClass().getName(),AccountErrorCode.ALIAS_ERROR);
  }
  AliasPo aliasPo=alisaStorageService.getAlias(alias.getAlias()).getData();
  if (aliasPo != null) {
    return ValidateResult.getFailedResult(this.getClass().getName(),AccountErrorCode.ALIAS_EXIST);
  }
  if (tx.isFreeOfFee()) {
    return ValidateResult.getFailedResult(alias.getClass().getName(),TransactionErrorCode.FEE_NOT_RIGHT);
  }
  CoinData coinData=tx.getCoinData();
  if (null == coinData) {
    return ValidateResult.getFailedResult(this.getClass().getName(),TransactionErrorCode.FEE_NOT_RIGHT);
  }
  Na realFee=tx.getFee();
  Na fee=TransactionFeeCalculator.getFee(tx.size());
  if (realFee.isLessThan(fee.add(AccountConstant.ALIAS_NA))) {
    return ValidateResult.getFailedResult(this.getClass().getName(),TransactionErrorCode.FEE_NOT_RIGHT);
  }
  P2PKHScriptSig sig=new P2PKHScriptSig();
  try {
    sig.parse(tx.getScriptSig());
  }
 catch (  NulsException e) {
    Log.error(e);
    return ValidateResult.getFailedResult(this.getClass().getName(),e.getMessage());
  }
  if (!Arrays.equals(tx.getTxData().getAddress(),AddressTool.getAddress(sig.getPublicKey()))) {
    ValidateResult result=ValidateResult.getFailedResult(this.getClass().getName(),"String_Node_Str");
    result.setLevel(SeverityLevelEnum.FLAGRANT_FOUL);
    return result;
  }
  return ValidateResult.getSuccessResult();
}