diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-10-11 00:46:57 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-10-11 00:46:57 +0000 |
commit | 301616f7ffc12a419c7fd12f79d058847f49ecd0 (patch) | |
tree | e54b7194c6bd8478217bdf25c5762764974bae77 | |
parent | 15381741467d0803cf90873d8f193dc2d0040419 (diff) | |
download | gcc-301616f7ffc12a419c7fd12f79d058847f49ecd0.zip gcc-301616f7ffc12a419c7fd12f79d058847f49ecd0.tar.gz gcc-301616f7ffc12a419c7fd12f79d058847f49ecd0.tar.bz2 |
runtime: Report len out of range for large len when making slice.
From-SVN: r203401
-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 591ab37..f08cb01 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; |