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

A limitation of libsnark may cause "Segmentation fault" #170

Open
youwenbusi opened this issue Jan 12, 2020 · 0 comments
Open

A limitation of libsnark may cause "Segmentation fault" #170

youwenbusi opened this issue Jan 12, 2020 · 0 comments

Comments

@youwenbusi
Copy link

youwenbusi commented Jan 12, 2020

When I used libsnark to build a small gadget and writed a test file for it, I encountered a problem of "Segmentation fault". I used gdb to trace that fault and found that it was caused by the function : r1cs_constraint_system::swap_AB_if_beneficial(). More specifically, it caused by the statement :libff::bit_vector touched_by_A(this->num_variables() + 1, false), touched_by_B(this->num_variables() + 1, false). The statement applies two arrays with the length of num_variables in the gatget. Thus if we design a gadget with a large numble of variables, this statement will cause a "Segmentation fault". I have tested it in my machine(Linux ubuntu 4.4.0-21-generic ,Total Memory 4 GB) that if there are more than 300000 variables, it will run into that problrm. If this function is necessary for making proof, it should be writed with the function "malloc()" or others to allocated memory dynamically to support more complicated gadget.

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

1 participant