-
Notifications
You must be signed in to change notification settings - Fork 118
Open
Labels
Description
We should apply the following to every places where are using method.Inputs.Copy(&input, args) to avoid panic during parsing precompile's inputs.
evm/precompiles/ics20/types.go
Lines 233 to 243 in 0e511d3
| // safeCopyInputs is a helper function to safely copy inputs from the method to the args. | |
| // It recovers from any panic that might occur during the copy operation and returns an error instead. | |
| func safeCopyInputs(method *abi.Method, args []interface{}, pageRequest *PageRequest) (err error) { | |
| defer func() { | |
| if r := recover(); r != nil { | |
| err = fmt.Errorf("panic during method.Inputs.Copy: %v", r) | |
| } | |
| }() | |
| err = method.Inputs.Copy(pageRequest, args) | |
| return | |
| } |
mmsqe and yihuang