Zokrates / ZoKrates

A toolbox for zkSNARKs on Ethereum
https://zokrates.github.io
GNU Lesser General Public License v3.0
1.81k stars 361 forks source link

Out of bounds index found during static analysis #1307

Closed dark64 closed 1 year ago

dark64 commented 1 year ago

Description

The rhs of the conditional expression appears to be evaluated regardless of the condition. This should not happen if the condition is known at compile-time.

Environment

Steps to Reproduce

def main() {
    field[2] a = [0; 2];
    for u32 i in 1..2 {
        field b = (i == 1) ? 0 : a[i - 2];
    }
}

Error: Out of bounds index (4294967295 >= 2) found during static analysis