X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=libiberty%2Fcp-demangle.c;h=aa78c86dd443c5078c5f440ebeaafd01ae3cd8ec;hb=58920b5be048726fca38e4e6ddcaa02ae6d9c1b8;hp=779b4e763a05f8328c40fe3775753af9947001d6;hpb=c1202057eb9161a86af27d867703235fee7b7555;p=deliverable%2Fbinutils-gdb.git diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 779b4e763a..aa78c86dd4 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -192,9 +192,9 @@ static void d_init_info (const char *, int, size_t, struct d_info *); #else #ifdef __STDC__ #ifdef __STDC_VERSION__ -#if __STDC_VERSION__ >= 199901L +#if __STDC_VERSION__ >= 199901L && !__STDC_NO_VLA__ #define CP_DYNAMIC_ARRAYS -#endif /* __STDC__VERSION >= 199901L */ +#endif /* __STDC_VERSION__ >= 199901L && !__STDC_NO_VLA__ */ #endif /* defined (__STDC_VERSION__) */ #endif /* defined (__STDC__) */ #endif /* ! defined (__GNUC__) */ @@ -1330,8 +1330,14 @@ d_encoding (struct d_info *di, int top_level) really apply here; this happens when parsing a class which is local to a function. */ if (dc->type == DEMANGLE_COMPONENT_LOCAL_NAME) - while (is_fnqual_component_type (d_right (dc)->type)) - d_right (dc) = d_left (d_right (dc)); + { + while (d_right (dc) != NULL + && is_fnqual_component_type (d_right (dc)->type)) + d_right (dc) = d_left (d_right (dc)); + + if (d_right (dc) == NULL) + dc = NULL; + } } else { @@ -3359,7 +3365,7 @@ d_expression_1 (struct d_info *di) d_advance (di, 2); if (peek == 't') type = cplus_demangle_type (di); - if (!d_peek_next_char (di)) + if (!d_peek_char (di) || !d_peek_next_char (di)) return NULL; return d_make_comp (di, DEMANGLE_COMPONENT_INITIALIZER_LIST, type, d_exprlist (di, 'E')); @@ -4761,12 +4767,8 @@ d_print_comp_inner (struct d_print_info *dpi, int options, typed_name = d_right (typed_name); if (typed_name->type == DEMANGLE_COMPONENT_DEFAULT_ARG) typed_name = typed_name->u.s_unary_num.sub; - if (typed_name == NULL) - { - d_print_error (dpi); - return; - } - while (is_fnqual_component_type (typed_name->type)) + while (typed_name != NULL + && is_fnqual_component_type (typed_name->type)) { if (i >= sizeof adpm / sizeof adpm[0]) { @@ -4785,6 +4787,11 @@ d_print_comp_inner (struct d_print_info *dpi, int options, typed_name = d_left (typed_name); } + if (typed_name == NULL) + { + d_print_error (dpi); + return; + } } /* If typed_name is a template, then it applies to the