summaryrefslogtreecommitdiffstats
path: root/libgo/runtime/go-make-slice.c
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-28 21:25:20 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-28 21:25:20 +0000
commitaef67bb4faf41195e234abd28ff916414e112c0c (patch)
treec312f5f6a11f323dc9f8d70c8f1604219de561bb /libgo/runtime/go-make-slice.c
parent877584e4ea0ece6c88a22ccec3f2a4218c98212e (diff)
downloadppe42-gcc-aef67bb4faf41195e234abd28ff916414e112c0c.tar.gz
ppe42-gcc-aef67bb4faf41195e234abd28ff916414e112c0c.zip
runtime: Better detection of memory allocation request overflow.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191841 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/runtime/go-make-slice.c')
-rw-r--r--libgo/runtime/go-make-slice.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libgo/runtime/go-make-slice.c b/libgo/runtime/go-make-slice.c
index 42b412c772b..822c9b68f0a 100644
--- a/libgo/runtime/go-make-slice.c
+++ b/libgo/runtime/go-make-slice.c
@@ -37,7 +37,7 @@ __go_make_slice2 (const struct __go_type_descriptor *td, uintptr_t len,
if (cap < len
|| (uintptr_t) icap != cap
|| (std->__element_type->__size > 0
- && cap > (uintptr_t) -1U / std->__element_type->__size))
+ && cap > MaxMem / std->__element_type->__size))
runtime_panicstring ("makeslice: cap out of range");
ret.__count = ilen;
OpenPOWER on IntegriCloud