From e0df53dd42f2ce39a6eebc879e535698eca88aff Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 21 Aug 2013 14:27:10 +0000 Subject: [PATCH] * ipa.c (ipa_profile_read_summary): Fix buffer overflow. From-SVN: r201900 --- gcc/ChangeLog | 4 ++++ gcc/ipa.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 478714cdace..cfc21cf670c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2013-08-20 Martin Liska + + * ipa.c (ipa_profile_read_summary): Fix buffer overflow. + 2013-08-21 Rainer Orth * config/sol2-10.h (TARGET_LIBC_HAS_FUNCTION): Don't nest diff --git a/gcc/ipa.c b/gcc/ipa.c index 1578aed70e8..7e8a82cc432 100644 --- a/gcc/ipa.c +++ b/gcc/ipa.c @@ -1397,7 +1397,7 @@ ipa_profile_read_summary (void) static unsigned int ipa_profile (void) { - struct cgraph_node **order = XCNEWVEC (struct cgraph_node *, cgraph_n_nodes); + struct cgraph_node **order; struct cgraph_edge *e; int order_pos; bool something_changed = false; @@ -1575,6 +1575,7 @@ ipa_profile (void) nuseless, nuseless * 100.0 / nindirect, nconverted, nconverted * 100.0 / nindirect); + order = XCNEWVEC (struct cgraph_node *, cgraph_n_nodes); order_pos = ipa_reverse_postorder (order); for (i = order_pos - 1; i >= 0; i--) {