mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-09 22:51:02 +00:00
Reworded max int error and reset max int value
This commit is contained in:
parent
413492552c
commit
d9f2792d1f
1 changed files with 3 additions and 4 deletions
|
|
@ -23,7 +23,6 @@ import (
|
|||
"math/bits"
|
||||
"sort"
|
||||
"unsafe"
|
||||
"math"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
|
@ -3945,7 +3944,7 @@ func (op *op) WriteTo(w io.Writer) (n int64, err error) {
|
|||
}
|
||||
|
||||
var minOpSize = 13
|
||||
var maxOpSize = math.MaxInt64/8 - 13
|
||||
var maxOpN = 1000000
|
||||
|
||||
// UnmarshalBinary decodes data into an op.
|
||||
func (op *op) UnmarshalBinary(data []byte) error {
|
||||
|
|
@ -3963,8 +3962,8 @@ func (op *op) UnmarshalBinary(data []byte) error {
|
|||
_, _ = h.Write(data[0:9])
|
||||
|
||||
if op.typ > 1 {
|
||||
if maxOpSize < int(op.value){
|
||||
return fmt.Errorf("too big")
|
||||
if maxOpN < int(op.value){
|
||||
return fmt.Errorf("Maximum operation size exceeded")
|
||||
}
|
||||
if len(data) < int(13+op.value*8) {
|
||||
return fmt.Errorf("op data truncated - expected %d, got %d", 13+op.value*8, len(data))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue