From b681d489e90abd526a7a8fdbd4d12f2170dde358 Mon Sep 17 00:00:00 2001 From: Cassandra Heart <7929478+CassOnMars@users.noreply.github.com> Date: Tue, 20 Feb 2024 23:02:14 -0600 Subject: [PATCH] fix: verify frame output size before sending to VDF verifier (#60) --- node/crypto/wesolowski_frame_prover.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/node/crypto/wesolowski_frame_prover.go b/node/crypto/wesolowski_frame_prover.go index 5f72318..dcb36a9 100644 --- a/node/crypto/wesolowski_frame_prover.go +++ b/node/crypto/wesolowski_frame_prover.go @@ -103,6 +103,13 @@ func (w *WesolowskiFrameProver) VerifyMasterClockFrame( ) } + if len(frame.Output) != 516 { + return errors.Wrap( + errors.New("invalid output"), + "verify clock frame", + ) + } + b := sha3.Sum256(input) v := vdf.New(frame.Difficulty, b) proof := [516]byte{} @@ -421,6 +428,13 @@ func (w *WesolowskiFrameProver) VerifyDataClockFrame( ) } + if len(frame.Output) != 516 { + return errors.Wrap( + errors.New("invalid output"), + "verify clock frame", + ) + } + b := sha3.Sum256(input) v := vdf.New(frame.Difficulty, b) proof := [516]byte{}