Jon-Becker / heimdall-rs

Heimdall is an advanced EVM smart contract toolkit specializing in bytecode analysis and extracting information from unverified contracts.
http://heimdall.rs
MIT License
1.19k stars 125 forks source link

bug: crash on some small contract #519

Open fala13 opened 5 days ago

fala13 commented 5 days ago

Component

Heimdall (Core)

Have you ensured that you are up to date?

What version of Heimdall are you on?

8.4

Operating System

Linux

Describe the bug

Seems like some proxy or something. Reporting, since it's a long time since I've seen crash:

( https://etherscan.io/address/0xb8d5c36e1bd74e9dd1dbdbe938884f538c73a3a8#code ) :


./heimdall-rs/target/release/heimdall decompile 0xb8d5c36e1bd74e9dd1dbdbe938884f538c73a3a8 -r http://localhost:8545 -vvvv
2024-11-17T21:50:50.744633Z TRACE heimdall_common::utils::http: GET https://api.github.com/repos/Jon-Becker/heimdall-rs/releases/latest
2024-11-17T21:50:51.037982Z TRACE heimdall_common::utils::http: GET https://api.github.com/repos/Jon-Becker/heimdall-rs/releases/latest: Response { url: "https://api.github.com/repos/Jon-Becker/heimdall-rs/releases/latest", status: 200, headers: {"date": "Sun, 17 Nov 2024 21:50:50 GMT", "content-type": "application/json; charset=utf-8", "cache-control": "public, max-age=60, s-maxage=60", "vary": "Accept,Accept-Encoding, Accept, X-Requested-With", "etag": "W/\"...\"", "last-modified": "Mon, 26 Aug 2024 20:25:02 GMT", "x-github-media-type": "github.v3; format=json", "x-github-api-version-selected": "2022-11-28", "access-control-expose-headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", "access-control-allow-origin": "*", "strict-transport-security": "max-age=31536000; includeSubdomains; preload", "x-frame-options": "deny", "x-content-type-options": "nosniff", "x-xss-protection": "0", "referrer-policy": "origin-when-cross-origin, strict-origin-when-cross-origin", "content-security-policy": "default-src 'none'", "server": "github.com", "x-ratelimit-limit": "60", "x-ratelimit-remaining": "56", "x-ratelimit-reset": "1731883716", "x-ratelimit-resource": "core", "x-ratelimit-used": "4", "accept-ranges": "bytes", "content-length": "6424", "x-github-request-id": "..."} }
2024-11-17T21:50:51.038648Z DEBUG heimdall_cache: cache hit for key: 'chain_id.http-localhost-8545'
2024-11-17T21:50:51.038670Z DEBUG heimdall_cache: cache hit for key: 'contract.1.0xb8d5C36E1BD74E9dd1DBdBe938884F538c73A3A8'
2024-11-17T21:50:51.038676Z DEBUG heimdall_decompiler::core: fetching target bytecode took 65.183µs
2024-11-17T21:50:51.038682Z DEBUG heimdall_common::ether::compiler: detected compiler unknown unknown.
2024-11-17T21:50:51.038687Z  WARN heimdall_common::ether::compiler: unknown is not fully supported by heimdall
2024-11-17T21:50:51.038714Z DEBUG heimdall_disassembler::core: fetching target bytecode took 2.35µs
2024-11-17T21:50:51.038727Z DEBUG heimdall_disassembler::core: disassembly took 7.981µs
2024-11-17T21:50:51.038730Z  INFO heimdall_disassembler::core: disassembled 49 bytes successfully
2024-11-17T21:50:51.038733Z DEBUG heimdall_disassembler::core: disassembly took 20.771µs
2024-11-17T21:50:51.038744Z TRACE heimdall_vm::ext::selectors: optimistically assuming instruction 000004 PUSH4 57e871e7 is a function selector
thread 'main' panicked at crates/vm/src/core/vm.rs:1161:39:
index out of bounds: the len is 49 but the index is 49
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic_bounds_check
   3: heimdall_vm::core::vm::VM::_step
   4: heimdall_vm::core::vm::VM::step
   5: heimdall_decompiler::core::decompile_impl::{{closure}}
   6: heimdall::main::{{closure}}
   7: heimdall::main