From: Ian Lance Taylor Date: Fri, 11 Oct 2013 00:46:57 +0000 (+0000) Subject: runtime: Report len out of range for large len when making slice. X-Git-Tag: releases/gcc-4.9.0~3605 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=301616f7ffc12a419c7fd12f79d058847f49ecd0;p=thirdparty%2Fgcc.git runtime: Report len out of range for large len when making slice. From-SVN: r203401 --- diff --git a/libgo/runtime/go-make-slice.c b/libgo/runtime/go-make-slice.c index 591ab37e0c69..f08cb012dc83 100644 --- a/libgo/runtime/go-make-slice.c +++ b/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;