Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check the buffer length read in constant meta, if it's not equal to t… #373

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions ast/Serializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
"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
Expand Down Expand Up @@ -1535,11 +1536,16 @@
return err
}
byteArr := make([]byte, length)
_, err = reader.Read(byteArr)

readCount, err = reader.Read(byteArr)

Check failure on line 1540 in ast/Serializer.go

View workflow job for this annotation

GitHub Actions / build

undefined: readCount
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am very sorry, I committed the code wrongly. I should be
readCount, err := reader.Reader(byteArr)

Forgot to puth the collon there. Coud you change it accordingly and push again.

if err != nil {

return err
}
if uint64(readCount) != length {

Check failure on line 1545 in ast/Serializer.go

View workflow job for this annotation

GitHub Actions / build

undefined: readCount

return io.ErrShortBuffer
}
meta.ValueBytes = byteArr

b, err := ReadBoolFromReader(reader)
Expand Down
Loading