diff --git a/ast/Serializer.go b/ast/Serializer.go index fcacbe38..1c3faa3d 100755 --- a/ast/Serializer.go +++ b/ast/Serializer.go @@ -18,11 +18,12 @@ import ( "bytes" "encoding/binary" "fmt" - "github.com/hyperjumptech/grule-rule-engine/ast/unique" - "github.com/sirupsen/logrus" "io" "math" "reflect" + + "github.com/hyperjumptech/grule-rule-engine/ast/unique" + "github.com/sirupsen/logrus" ) // NodeType is to label a Meta information within catalog @@ -1535,11 +1536,16 @@ func (meta *ConstantMeta) ReadMetaFrom(reader io.Reader) error { return err } byteArr := make([]byte, length) - _, err = reader.Read(byteArr) + + readCount, err = reader.Read(byteArr) if err != nil { return err } + if uint64(readCount) != length { + + return io.ErrShortBuffer + } meta.ValueBytes = byteArr b, err := ReadBoolFromReader(reader)