title: InvalidUnsafeString layout: article

InvalidUnsafeString occurs when unsafe.String is called with
a length argument that is not of integer type, negative, or
out of bounds. It also occurs if it is used in a package
compiled for a language version before go1.20.

Example:
 import "unsafe"

 var b [10]byte
 var _ = unsafe.String(&b[0], -1)