Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion functions/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ type _SubSelectFunctionArgs struct {

type _SplitFunctionArgs struct {
String string `vfilter:"required,field=string,doc=The value to split"`
Sep string `vfilter:"optional,field=sep,doc=The separator that will be used to split"`
Sep string `vfilter:"optional,field=sep,doc=The separator regex that will be used to split"`
Sep_string string `vfilter:"optional,field=sep_string,doc=The separator as string that will be used to split"`
}
type _SplitFunction struct{}
Expand Down
5 changes: 3 additions & 2 deletions protocols/protocol_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ func (self AddDispatcher) Add(scope types.Scope, a types.Any, b types.Any) types
if ok {
// Estimate how much memory we will use when adding the
// string
memory := len(t) * len(b_str)
memory := len(t) + len(b_str)
if memory > 100000000 { // 100mb
scope.Log("Multiply Str x Int exceeded memory limits")
scope.Log("Adding Str + Str exceeded memory limits. LH Str %v + RH Str %v = %v",
len(t), len(b_str), len(t)+len(b_str))
return &types.Null{}
}

Expand Down
5 changes: 3 additions & 2 deletions protocols/protocol_mul.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ func (self MulDispatcher) Mul(scope types.Scope, a types.Any, b types.Any) types
b_int, ok := utils.ToInt64(b)
if ok {
// Estimate how much memory we will use when duplicating the string
memory := len(t) * int(b_int)
memory := uint64(len(t)) * uint64(b_int)
if memory > 100000000 { // 100mb
scope.Log("Multiply Str x Int exceeded memory limits")
scope.Log("Multiply Str x Int exceeded memory limits. Len Str %v * Count %v = %v",
len(t), int(b_int), memory)
return &types.Null{}
}
return strings.Repeat(t, int(b_int))
Expand Down