From: jamborm Date: Tue, 11 Jun 2013 12:50:13 +0000 (+0000) Subject: 2013-06-11 Martin Jambor X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fd8b458b0210a7f91233a78ae40a3dedad9ab9d6;p=thirdparty%2Fgcc.git 2013-06-11 Martin Jambor * ipa-cp.c (ipa_get_indirect_edge_target_1): Check that param_index is within bounds at the beginning of the function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199953 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f346780e5f26..f02e6b2a6e94 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-06-11 Martin Jambor + + * ipa-cp.c (ipa_get_indirect_edge_target_1): Check that param_index is + within bounds at the beginning of the function. + 2013-06-11 Alan Modra * varasm.c (get_section): Don't die on !DECL_P decl. Tidy error diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index af4e94862d3a..9c29d1dbc91c 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -1481,7 +1481,8 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie, tree otr_type; tree t; - if (param_index == -1) + if (param_index == -1 + || known_vals.length () <= (unsigned int) param_index) return NULL_TREE; if (!ie->indirect_info->polymorphic) @@ -1516,8 +1517,7 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie, t = NULL; } else - t = (known_vals.length () > (unsigned int) param_index - ? known_vals[param_index] : NULL); + t = known_vals[param_index]; if (t && TREE_CODE (t) == ADDR_EXPR