diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-11 00:46:57 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-11 00:46:57 +0000 |
commit | 220c51cc6412f18ac1b0ae05d9f95e8769fdae8e (patch) | |
tree | e54b7194c6bd8478217bdf25c5762764974bae77 /libgo | |
parent | ec516c765dd1c2dfd9c9b3fd252a751448e3a587 (diff) | |
download | linaro-gcc-220c51cc6412f18ac1b0ae05d9f95e8769fdae8e.tar.gz linaro-gcc-220c51cc6412f18ac1b0ae05d9f95e8769fdae8e.tar.bz2 linaro-gcc-220c51cc6412f18ac1b0ae05d9f95e8769fdae8e.zip |
runtime: Report len out of range for large len when making slice.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203401 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/runtime/go-make-slice.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libgo/runtime/go-make-slice.c b/libgo/runtime/go-make-slice.c index 591ab37e0c6..f08cb012dc8 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; |