mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-13 13:10:56 +08:00
runtime: Report len out of range for large len when making slice.
From-SVN: r203401
This commit is contained in:
parent
1538174146
commit
301616f7ff
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user