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

fix: ABI decoder crashing on certain inputs #1130

Merged
merged 21 commits into from
Oct 17, 2023

Conversation

Br1ght0ne
Copy link
Member

@Br1ght0ne Br1ght0ne commented Sep 11, 2023

Close #1108.
Thanks to @segfault-magnet for helping with debugging stack_overflow and the idea for DebugWithDepth.

Checklist

  • I have linked to any relevant issues.
  • I have updated the documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary labels.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@Br1ght0ne Br1ght0ne added the audit-report Related to the audit report label Sep 11, 2023
@Br1ght0ne Br1ght0ne self-assigned this Sep 11, 2023
@Br1ght0ne Br1ght0ne changed the title fix: handle division by zero Fix ABI decoder crashing on certain inputs Sep 11, 2023
@Br1ght0ne Br1ght0ne enabled auto-merge (squash) September 27, 2023 19:25
hal3e
hal3e previously approved these changes Sep 29, 2023
Copy link
Contributor

@hal3e hal3e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Great job!

@hal3e hal3e changed the title Fix ABI decoder crashing on certain inputs fix: ABI decoder crashing on certain inputs Sep 29, 2023
MujkicA
MujkicA previously approved these changes Sep 29, 2023
Copy link
Contributor

@iqdecay iqdecay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some remarks regarding error messages, otherwise lgtm!

packages/fuels-core/src/codec/abi_decoder.rs Outdated Show resolved Hide resolved
packages/fuels-core/src/codec/abi_decoder.rs Outdated Show resolved Hide resolved
packages/fuels-core/src/types/param_types.rs Outdated Show resolved Hide resolved
packages/fuels-core/src/types/param_types.rs Outdated Show resolved Hide resolved
hal3e and others added 2 commits October 5, 2023 10:59
Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
Co-authored-by: iqdecay <victor@berasconsulting.com>
hal3e and others added 2 commits October 6, 2023 09:44
Extra changes:
- `ABIDecoder.config` is now `pub`
- `ParamType::validate_is_decodable` now uses `DebugWithDepth` (with
depth 0 in tests and `decoder.max_depth` in use)
- `DebugWithDepth` moved to `utils` module
@Br1ght0ne
Copy link
Member Author

Br1ght0ne commented Oct 6, 2023

To help with reviewing, here are the changes added in latest merge (a7a9acc):

Extra changes:

  • ABIDecoder.config is now pub (to pass max_depth in ReceiptParser::parse)
  • ParamType::validate_is_decodable now uses DebugWithDepth, with
    depth 0 in tests (for consistent error messages) and decoder.max_depth in use (to give some insight into the type that causes the overflow)
  • DebugWithDepth moved to utils module

EDIT: DebugWithDepth now (3da2abc) lives in param_types.rs

@Br1ght0ne Br1ght0ne requested a review from iqdecay October 6, 2023 16:55
Copy link
Contributor

@iqdecay iqdecay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You removed comments that are useful IMO. Also some imprecisions in the error message.

packages/fuels-core/src/types/param_types.rs Outdated Show resolved Hide resolved
packages/fuels-core/src/types/param_types.rs Outdated Show resolved Hide resolved
packages/fuels-programs/src/call_utils.rs Show resolved Hide resolved
Copy link
Member

@digorithm digorithm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work, @Br1ght0ne!

packages/fuels-core/src/types/param_types.rs Show resolved Hide resolved
Copy link
Contributor

@hal3e hal3e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@Br1ght0ne Br1ght0ne merged commit 2f6ed3a into master Oct 17, 2023
39 checks passed
@Br1ght0ne Br1ght0ne deleted the oleksii/abi-decoder-crashes branch October 17, 2023 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audit-report Related to the audit report package:core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TOB-FUEL-32: ABI decoder is crashing on certain inputs
6 participants