diff options
| author | Russ Cox <rsc@golang.org> | 2011-07-27 16:47:45 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2011-07-27 16:47:45 -0400 |
| commit | a84abbe5086e8a9d280f3f5bd94f3b7940a00eff (patch) | |
| tree | ebef8b708551182d7c1e01e3b566c7bbb372427a /src/pkg/runtime/slice.c | |
| parent | dec8009fe871d4bd108451306bd15fafb7cf6726 (diff) | |
| download | go-a84abbe5086e8a9d280f3f5bd94f3b7940a00eff.tar.xz | |
gc: zero-width struct, zero-length array fixes
Fixes #1774.
Fixes #2095.
Fixes #2097.
R=ken2
CC=golang-dev
https://golang.org/cl/4826046
Diffstat (limited to 'src/pkg/runtime/slice.c')
| -rw-r--r-- | src/pkg/runtime/slice.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pkg/runtime/slice.c b/src/pkg/runtime/slice.c index 9146c177f2..70534279b5 100644 --- a/src/pkg/runtime/slice.c +++ b/src/pkg/runtime/slice.c @@ -20,7 +20,7 @@ runtimeĀ·makeslice(SliceType *t, int64 len, int64 cap, Slice ret) { if(len < 0 || (int32)len != len) runtimeĀ·panicstring("makeslice: len out of range"); - if(cap < len || (int32)cap != cap || cap > ((uintptr)-1) / t->elem->size) + if(cap < len || (int32)cap != cap || t->elem->size > 0 && cap > ((uintptr)-1) / t->elem->size) runtimeĀ·panicstring("makeslice: cap out of range"); makeslice1(t, len, cap, &ret); |
