mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-06 19:07:50 +00:00
Addressed review feedback
This commit is contained in:
parent
d9f2792d1f
commit
d24a157947
2 changed files with 5 additions and 3 deletions
|
|
@ -30,7 +30,7 @@ func TestUnmarshalBinary(t *testing.T) {
|
|||
{
|
||||
cr : []byte("<0\x000\x00\x00\x00\x00000000000000" +
|
||||
"0"), //"<000000000000000"
|
||||
expected : "unmarshaling as pilosa roaring: too big",
|
||||
expected : "unmarshaling as pilosa roaring: Maximum operation size exceeded",
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3944,7 +3944,7 @@ func (op *op) WriteTo(w io.Writer) (n int64, err error) {
|
|||
}
|
||||
|
||||
var minOpSize = 13
|
||||
var maxOpN = 1000000
|
||||
var maxBatchSize = 1<<59
|
||||
|
||||
// UnmarshalBinary decodes data into an op.
|
||||
func (op *op) UnmarshalBinary(data []byte) error {
|
||||
|
|
@ -3962,7 +3962,9 @@ func (op *op) UnmarshalBinary(data []byte) error {
|
|||
_, _ = h.Write(data[0:9])
|
||||
|
||||
if op.typ > 1 {
|
||||
if maxOpN < int(op.value){
|
||||
// This ensures that in doing 13+op.value*8, the max int won't be exceeded and a wrap around case
|
||||
// (resulting in a negative value) won't occur in the slice indexing while writing
|
||||
if int(op.value) > maxBatchSize {
|
||||
return fmt.Errorf("Maximum operation size exceeded")
|
||||
}
|
||||
if len(data) < int(13+op.value*8) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue