This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fix end-of-string overrun problems in C++ demangler


gkeating@apple.com (Geoffrey Keating) writes:

> 2006-12-20  Geoffrey Keating  <geoffk@apple.com>
> 
> 	* 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.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]