aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8/libgo/runtime/go-make-slice.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.8/libgo/runtime/go-make-slice.c')
-rw-r--r--gcc-4.8/libgo/runtime/go-make-slice.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc-4.8/libgo/runtime/go-make-slice.c b/gcc-4.8/libgo/runtime/go-make-slice.c
index 591ab37e0..f08cb012d 100644
--- a/gcc-4.8/libgo/runtime/go-make-slice.c
+++ b/gcc-4.8/libgo/runtime/go-make-slice.c
@@ -34,7 +34,10 @@ __go_make_slice2 (const struct __go_type_descriptor *td, uintptr_t len,
std = (const struct __go_slice_type *) td;
ilen = (intgo) len;
- if (ilen < 0 || (uintptr_t) ilen != len)
+ if (ilen < 0
+ || (uintptr_t) ilen != len
+ || (std->__element_type->__size > 0
+ && len > MaxMem / std->__element_type->__size))
runtime_panicstring ("makeslice: len out of range");
icap = (intgo) cap;