diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-09-28 21:25:20 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-09-28 21:25:20 +0000 |
commit | ddd06f537235203ce3e9f7a2a5e454410317995c (patch) | |
tree | c312f5f6a11f323dc9f8d70c8f1604219de561bb /libgo/runtime/go-append.c | |
parent | e78410bf1198e3ce4a37678c991821359b0fde79 (diff) | |
download | gcc-ddd06f537235203ce3e9f7a2a5e454410317995c.zip gcc-ddd06f537235203ce3e9f7a2a5e454410317995c.tar.gz gcc-ddd06f537235203ce3e9f7a2a5e454410317995c.tar.bz2 |
runtime: Better detection of memory allocation request overflow.
From-SVN: r191841
Diffstat (limited to 'libgo/runtime/go-append.c')
-rw-r--r-- | libgo/runtime/go-append.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libgo/runtime/go-append.c b/libgo/runtime/go-append.c index 3a0c778..dac4c90 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); |