projects
/
gcc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1538174
)
runtime: Report len out of range for large len when making slice.
author
Ian Lance Taylor
<ian@gcc.gnu.org>
Fri, 11 Oct 2013 00:46:57 +0000
(
00:46
+0000)
committer
Ian Lance Taylor
<ian@gcc.gnu.org>
Fri, 11 Oct 2013 00:46:57 +0000
(
00:46
+0000)
From-SVN: r203401
libgo/runtime/go-make-slice.c
patch
|
blob
|
history
diff --git
a/libgo/runtime/go-make-slice.c
b/libgo/runtime/go-make-slice.c
index 591ab37e0c69e23d0ad3d9488af9e681d033e50e..f08cb012dc83a125d0e582386dd30834e32fd3fb 100644
(file)
--- 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;