You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue is that an error occurred during the execution of CallData.execute, but it was not handled in this code.
func (td*CallData) ExecuteData(datastring) ([]byte, error) {
iflen(data) >0 {
input:= []byte(data)
tpl, err:=td.execute(data)
// The error is not being handled when err is not niliferr==nil&&tpl!=nil {
input=tpl.Bytes()
}
returninput, nil
}
return []byte{}, nil
}
error:
template: call_template_data:1:139: executing "call_template_data" at <randomString 100>: error calling randomString: runtime error: index out of range [1212]
When I recover the stringWithCharset method, I found that the error was triggered when executing seededRand.Intn(len(charset)).
funcstringWithCharset(lengthint, charsetstring) string {
deferfunc() {
ifr:=recover(); r!=nil {
ife, ok:=r.(error); ok {
// index out of range errorpanic(e)
}
}
}()
b:=make([]byte, length)
fori:=rangeb {
b[i] =charset[seededRand.Intn(len(charset))]
}
returnstring(b)
}
root cause:
rand.Source is not safe for concurrent use by multiple goroutines. This also applies when used in rand.Rand.
I want to fix it and add benchmark tests
Environment
OS: [win 10]
ghz: [v0.117.0]
The text was updated successfully, but these errors were encountered:
Describe the bug
Error creating message from data. Data: xxx Error: invalid character '{' looking for beginning of object key string
CallData.execute
, but it was not handled in this code.error:
template: call_template_data:1:139: executing "call_template_data" at <randomString 100>: error calling randomString: runtime error: index out of range [1212]
stringWithCharset
method, I found that the error was triggered when executingseededRand.Intn(len(charset))
.rand.Source is not safe for concurrent use by multiple goroutines. This also applies when used in rand.Rand.
I want to fix it and add benchmark tests
Environment
The text was updated successfully, but these errors were encountered: