Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler crash with large constant #1329

Open
Safarah4783 opened this issue Jul 12, 2023 · 1 comment
Open

Compiler crash with large constant #1329

Safarah4783 opened this issue Jul 12, 2023 · 1 comment

Comments

@Safarah4783
Copy link

Description

I encountered a compiler crash when compiling a program with a large constant.

Environment

  • Compiler version: 0.8.7
  • Operating system: Ubuntu 22.04.2 LTS

Steps to Reproduce

Save the following code as src.zok:

def main(private field a) {
    assert(a > 8000000000000000000000000000000000000000000000000000000000000000000000000000 && a > 1);
}

The compile the code with:

zokrates compile -i src.zok

The compiler will crash with the following error:

Compiling src.zok

The compiler unexpectedly panicked
panicked at 'assertion failed: res.len() <= to', /home/Safarah4783/ZoKrates/zokrates_codegen/src/lib.rs:2020:21
This is unexpected, please submit a full bug report at https://github.com/Zokrates/ZoKrates/issues

However, if you remove the assertion condition that a > 1, the compiler will compile the code successfully.

def main(private field a) {
    // Remove the `&& a > 1` part
    assert(a > 8000000000000000000000000000000000000000000000000000000000000000000000000000);
}
@dark64
Copy link
Member

dark64 commented Jul 17, 2023

Thanks for the report, this seems to be fixed in #1309

@dark64 dark64 mentioned this issue Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants