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
Calling Info (and the other logging functions) will panic if the message contains a character that StringToUTF16 does not like. In particular, the docs say that 0x0 will cause it to panic.
Example:
loggerName := "my-logger"
wlog, err := eventlog.Open(loggerName)
if err != nil {
// Setup Windows Event log with the log source name and logging levels.
err = eventlog.InstallAsEventCreate(loggerName, eventlog.Info|eventlog.Warning|eventlog.Error)
if err != nil {
panic(err)
}
// Open a handler to the event logger.
wlog, err = eventlog.Open(loggerName)
if err != nil {
panic(err)
}
}
message := string([]byte{0x97, 0x00, 0x98})
wlog.Info(1, message) // This line will panic.
What did you see happen?
panic: syscall: string with NUL passed to StringToUTF16
What did you expect to see?
No output, no panic.
The text was updated successfully, but these errors were encountered:
Go version
go version go1.23.4 linux/amd64
Output of
go env
in your module/workspace:What did you do?
Calling
Info
(and the other logging functions) will panic if the message contains a character thatStringToUTF16
does not like. In particular, the docs say that0x0
will cause it to panic.Example:
What did you see happen?
panic: syscall: string with NUL passed to StringToUTF16
What did you expect to see?
No output, no panic.
The text was updated successfully, but these errors were encountered: