From 6aaad7b72f0da3b7685e164570ec67e8d69802d9 Mon Sep 17 00:00:00 2001 From: Daniel Liu <139250065@qq.com> Date: Mon, 19 Jan 2026 13:55:04 +0800 Subject: [PATCH] core/vm: avoid escape to heap #33537 (#1944) --- core/vm/contracts.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/vm/contracts.go b/core/vm/contracts.go index c4c7295ff9..a3c647ea35 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -228,11 +228,11 @@ func (c *ecrecover) Run(input []byte) ([]byte, error) { } // We must make sure not to modify the 'input', so placing the 'v' along with // the signature needs to be done on a new allocation - sig := make([]byte, crypto.SignatureLength) - copy(sig, input[64:128]) + var sig [crypto.SignatureLength]byte + copy(sig[:], input[64:128]) sig[64] = v // v needs to be at the end for libsecp256k1 - pubKey, err := crypto.Ecrecover(input[:32], sig) + pubKey, err := crypto.Ecrecover(input[:32], sig[:]) // make sure the public key is a valid one if err != nil { return nil, nil