Also prevent too much recursion in the assembly parser.#2770
Also prevent too much recursion in the assembly parser.#2770
Conversation
test/libsolidity/InlineAssembly.cpp
Outdated
| string input; | ||
| for (size_t i = 0; i < 20000; i++) | ||
| input += "{"; | ||
| input += "let x:u256 := 0:u256"; |
There was a problem hiding this comment.
Why are the tests passing if this has types?
There was a problem hiding this comment.
Because it requires there to be an error. I guess the parser just continues after the :.
There was a problem hiding this comment.
Ah right, it does not get until that point.
There was a problem hiding this comment.
Yep, 20000 is over the limit.
|
Include in changelog please. |
da44b49 to
36fe7d4
Compare
|
Fixed. |
308abe2 to
aeefc61
Compare
|
I get this: |
|
Interesting! Yes, macos has a much smaller stack size. So I guess we have to reduce the limit or reduce the size of stack frames. |
|
Reduced the max depth to 3000. |
ba88414 to
628b54c
Compare
|
There must be a different problem to stack size. The test for the Solidity parser works (worked even with the old limit), but the inline assembly one still fails even after reducing the stack limit. |
|
I think this is because the inline assembly parser just has larger stack frames. The inline assembly AST is built on the stack while the Solidity AST is built on the heap. |
|
Of course the proper way is to not have any recursion at all. |
|
Ran it again and it works. Probably there was some caching issue before. |
|
I guess before merging we should run the test in solc-js. |
|
Ok, will run the tests. |
|
Tests pass. |
With this I meant add a test case to solc-js and run it, since we don't know what kind of stack size / stack depth Emscripten / JS allows. |
|
Are you talking about a test that checks whether the recursion limit is hit before the stack height limit is hit? |
|
Yes, the same test we have here, but for solc-js (to validate Emscripten). |
No description provided.