OSDN Git Service
(root)
/
pf3gnuchains
/
gcc-fork.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
runtime: Better detection of memory allocation request overflow.
[pf3gnuchains/gcc-fork.git]
/
libgo
/
runtime
/
go-append.c
diff --git
a/libgo/runtime/go-append.c
b/libgo/runtime/go-append.c
index
3a0c778
..
dac4c90
100644
(file)
--- 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);