diff options
Diffstat (limited to 'src/runtime/slice.go')
| -rw-r--r-- | src/runtime/slice.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/runtime/slice.go b/src/runtime/slice.go index 2413a46d6a..8a0ce49fad 100644 --- a/src/runtime/slice.go +++ b/src/runtime/slice.go @@ -129,6 +129,12 @@ func unsafeslice(et *_type, ptr unsafe.Pointer, len int) { panicunsafeslicelen() } + if et.size == 0 { + if ptr == nil && len > 0 { + panicunsafeslicenilptr() + } + } + mem, overflow := math.MulUintptr(et.size, uintptr(len)) if overflow || mem > -uintptr(ptr) { if ptr == nil { |
