summaryrefslogtreecommitdiff
path: root/libgo/runtime/go-append.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-append.c
parent877584e4ea0ece6c88a22ccec3f2a4218c98212e (diff)
downloadgcc-aef67bb4faf41195e234abd28ff916414e112c0c.tar.gz
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-append.c')
-rw-r--r--libgo/runtime/go-append.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libgo/runtime/go-append.c b/libgo/runtime/go-append.c
index 3a0c7781126..dac4c902c15 100644
--- a/libgo/runtime/go-append.c
+++ b/libgo/runtime/go-append.c
@@ -54,6 +54,9 @@ __go_append (struct __go_open_array a, void *bvalues, uintptr_t bcount,
while (m < count);
}
+ if ((uintptr) m > MaxMem / element_size)
+ runtime_panicstring ("growslice: cap out of range");
+
n = __go_alloc (m * element_size);
__builtin_memcpy (n, a.__values, a.__count * element_size);