Consensys / linea-arithmetization

17 stars 18 forks source link

fix: OOB receives parameters that are sent to WCP greater than 16 bytes #809

Open lorenzogentile404 opened 1 week ago

lorenzogentile404 commented 1 week ago

Temporary, the following hack has been added:

private boolean callToLT(
    int k, BigInteger arg1Hi, BigInteger arg1Lo, BigInteger arg2Hi, BigInteger arg2Lo) {
  // TODO: reactivate preconditions and remove conditional initialization
  // Preconditions.checkArgument(arg1Hi.toByteArray().length <= 16);
  // Preconditions.checkArgument(arg1Lo.toByteArray().length <= 16);
  // Preconditions.checkArgument(arg2Hi.toByteArray().length <= 16);
  // Preconditions.checkArgument(arg2Lo.toByteArray().length <= 16);
  final EWord arg1 =
      arg1Lo.toByteArray().length <= 16 ? EWord.of(arg1Hi, arg1Lo) : EWord.of(arg1Lo);
  final EWord arg2 =
      arg2Lo.toByteArray().length <= 16 ? EWord.of(arg2Hi, arg2Lo) : EWord.of(arg2Lo);

However, it is necessary to identify the source of the issue and remove the hack.