Skip to content

Validator inner contract can panic on short calldata for UpdateValidators and SwitchValidators #2360

Description

@Ektisad25

System information
PlatON version: platon version
OS & Version: Windows/Linux/OSX
Commit hash : (if develop)

Expected behaviour
Invalid or truncated calldata for validator inner contract calls should be rejected with a clean error before any branch reads missing arguments.

Actual behaviour
The execute path only checks that the decoded input has at least 2 items, but the UpdateValidators and SwitchValidators branches read source[2]. If the third argument is missing, the code panics and relies on the deferred recover path instead of handling the malformed input explicitly.

Steps to reproduce the behaviour
1- Call the validator inner contract with UpdateValidators or SwitchValidators.
2- Provide only two RLP items instead of three. file PlatON-Go\core\vm\validator_inner_contract.go line 186 var source [][]byte
and triggers a panic, which is then converted into an execution failure.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions