From b9c5fa732c2444ce2594f4fda44fd8120abc2c47 Mon Sep 17 00:00:00 2001 From: Captain Date: Tue, 13 Jun 2023 01:10:17 +0000 Subject: [PATCH] RingSize Sanity Check Fix by Slixe --- config/version.go | 2 +- cryptography/crypto/protocol_structures.go | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/config/version.go b/config/version.go index b069966e..75cb3a93 100644 --- a/config/version.go +++ b/config/version.go @@ -20,4 +20,4 @@ import "github.com/blang/semver/v4" // right now it has to be manually changed // do we need to include git commitsha?? -var Version = semver.MustParse("3.5.3-117.DEROHE.STARGATE+18032023") +var Version = semver.MustParse("3.5.3-140.DEROHE.STARGATE+13062023") diff --git a/cryptography/crypto/protocol_structures.go b/cryptography/crypto/protocol_structures.go index ecfa123b..9116e948 100644 --- a/cryptography/crypto/protocol_structures.go +++ b/cryptography/crypto/protocol_structures.go @@ -16,11 +16,15 @@ package crypto -import "bytes" -import "encoding/binary" -import "math/big" -import "github.com/deroproject/derohe/cryptography/bn256" -import "github.com/deroproject/graviton" +import ( + "bytes" + "encoding/binary" + "fmt" + "math/big" + + "github.com/deroproject/derohe/cryptography/bn256" + "github.com/deroproject/graviton" +) type Statement struct { RingSize uint64 @@ -98,6 +102,9 @@ func (s *Statement) Deserialize(r *bytes.Reader) error { return err } s.RingSize = 1 << length + if s.RingSize > 128 { + return fmt.Errorf("ring size is too large") + } s.Bytes_per_publickey, err = r.ReadByte() if err != nil { @@ -223,3 +230,4 @@ type Proof struct { //ip *InnerProduct } */ +