This is the mail archive of the
mailing list for the GCC project.
Re: fix end-of-string overrun problems in C++ demangler
- From: Ian Lance Taylor <iant at google dot com>
- To: gkeating at apple dot com (Geoffrey Keating)
- Cc: dj at redhat dot com, ian at airs dot com, gcc-patches at gcc dot gnu dot org, binutils at sourceware dot org, gdb-patches at sourceware dot org
- Date: 20 Dec 2006 15:55:31 -0800
- Subject: Re: fix end-of-string overrun problems in C++ demangler
- References: <20061220223511.F04CE5771424@geoffk5.apple.com>
email@example.com (Geoffrey Keating) writes:
> 2006-12-20 Geoffrey Keating <firstname.lastname@example.org>
> * cp-demangle.h: Add comment explaining what to do to avoid
> overrunning string.
> (d_check_char): New.
> (d_next_char): Don't advance past trailing '\0'.
> * cp-demangle.c (cplus_demangle_mangled_name): Use d_check_char.
> (d_nested_name): Likewise.
> (d_special_name): Likewise.
> (d_call_offset): Likewise.
> (d_function_type): Likewise.
> (d_array_type): Likewise.
> (d_pointer_to_member_type): Likewise.
> (d_template_param): Likewise.
> (d_template_args): Likewise.
> (d_template_arg): Likewise.
> (d_expr_primary): Likewise.
> (d_local_name): Likewise.
> (d_substitution): Likewise.
> (d_ctor_dtor_name): Use d_advance rather than d_next_char.
> * testsuite/test-demangle.c: Include sys/mman.h.
> (MAP_ANONYMOUS): Define.
> (protect_end): New.
> (main): Use protect_end.
> * testsuite/demangle-expected: Add testcases for overrunning
> the end of the string.
Looks good to me. Thanks for cleaning this up.