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

Yul compilation failed: TypeError: Number literal too large (> 256 bits) #225

Closed
agroce opened this issue Jan 31, 2021 · 3 comments
Closed
Labels
comp: analyzer Everything that involves the analyzer pass type: bug

Comments

@agroce
Copy link

agroce commented Jan 31, 2021

Compiling this file:

contract  ERC20:
  pub def bar():
       888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
thread 'main' panicked at 'Yul compilation failed: {"errors":[{"component":"general","formattedMessage":"TypeError: Number literal too large (> 256 bits)\n --> input.yul:1:168:\n  |\n1 |  ... e\" { code { function $$bar() { pop(888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888) } function avail() -> ptr { ptr : ...\n  |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n","message":"Number literal too large (> 256 bits)","severity":"error","sourceLocation":{"end":284,"file":"input.yul","start":167},"type":"TypeError"}]}', compiler/src/lib.rs:45:27
stack backtrace:
   0: rust_begin_unwind
             at /rustc/c0b64d97beebb09325b5587abed39f4f1621026f/library/std/src/panicking.rs:493:5
   1: std::panicking::begin_panic_fmt
             at /rustc/c0b64d97beebb09325b5587abed39f4f1621026f/library/std/src/panicking.rs:435:5
   2: fe_compiler::compile
   3: fe::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Aborted

On latest github master, built with

[profile.dev]
debug = true
panic = "abort"

for fuzzing. Using https://github.com/agroce/afl-compiler-fuzzer

@agroce
Copy link
Author

agroce commented Jan 31, 2021

obviously some of these are really just sub-optimal error messages, not bug-bugs, but removing them will make fuzzing triage easier, if you get a chance...

@cburgdorf
Copy link
Collaborator

Thanks for running these fuzzings! It's a bug in the sense that this shouldn't even enter Yul compilation. This should be detected in the analyzer pass and return an actual user error (not a panic).

@cburgdorf cburgdorf added comp: analyzer Everything that involves the analyzer pass type: bug labels Feb 1, 2021
@agroce
Copy link
Author

agroce commented Feb 1, 2021

right. I figure these also may expose any missing checks on invariants that might indicate a miscompile, but that Yul may sometimes handle, so very nice to just flag them for inspection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: analyzer Everything that involves the analyzer pass type: bug
Projects
None yet
Development

No branches or pull requests

2 participants