cplus-dem.c (squangle_mop_up): Zero bsize/ksize after freeing btypevec/ktypevec.

* cplus-dem.c (squangle_mop_up): Zero bsize/ksize after freeing
	btypevec/ktypevec.
	* testsuite/demangle-expected: Add coverage tests.

From-SVN: r234645
This commit is contained in:
Mikhail Maltsev 2016-03-31 17:20:53 +00:00 committed by Jeff Law
parent 65e2146726
commit 916268f1f2
3 changed files with 19 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2016-03-31 Mikhail Maltsev <maltsevm@gmail.com>
Marcel Bohme boehme.marcel@gmail.com
* cplus-dem.c (squangle_mop_up): Zero bsize/ksize after freeing
btypevec/ktypevec.
* testsuite/demangle-expected: Add coverage tests.
2016-01-27 Iain Buclaw <ibuclaw@gdcproject.org> 2016-01-27 Iain Buclaw <ibuclaw@gdcproject.org>
* d-demangle.c (dlang_call_convention): Handle extern Objective-C * d-demangle.c (dlang_call_convention): Handle extern Objective-C

View File

@ -1237,11 +1237,13 @@ squangle_mop_up (struct work_stuff *work)
{ {
free ((char *) work -> btypevec); free ((char *) work -> btypevec);
work->btypevec = NULL; work->btypevec = NULL;
work->bsize = 0;
} }
if (work -> ktypevec != NULL) if (work -> ktypevec != NULL)
{ {
free ((char *) work -> ktypevec); free ((char *) work -> ktypevec);
work->ktypevec = NULL; work->ktypevec = NULL;
work->ksize = 0;
} }
} }

View File

@ -4421,3 +4421,13 @@ void baz<int>(A<sizeof (foo((int)(), (floatcomplex )00000000_00000000))>*)
--format=gnu-v3 --format=gnu-v3
_Z3fooI1FEN1XIXszdtcl1PclcvT__EEE5arrayEE4TypeEv _Z3fooI1FEN1XIXszdtcl1PclcvT__EEE5arrayEE4TypeEv
X<sizeof ((P(((F)())())).array)>::Type foo<F>() X<sizeof ((P(((F)())())).array)>::Type foo<F>()
#
# Tests a use-after-free problem
_Q.__0
::Q.(void)
#
# Tests a use-after-free problem
_Q10-__9cafebabe.
cafebabe.::-(void)