This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 3/4][libbacktrace] Don't point to released memory in backtrace_vector_release
- From: Jeff Law <law at redhat dot com>
- To: Tom de Vries <tdevries at suse dot de>, gcc-patches at gcc dot gnu dot org
- Cc: Ian Lance Taylor <ian at airs dot com>
- Date: Mon, 26 Nov 2018 15:25:22 -0700
- Subject: Re: [PATCH 3/4][libbacktrace] Don't point to released memory in backtrace_vector_release
- References: <20181122123647.GA2403@delia> <20181123205530.GA3517@delia>
On 11/23/18 1:55 PM, Tom de Vries wrote:
> [ was: Re: [PATCH 2/2][libbacktrace] Don't point to released memory in
> backtrace_vector_release ]
>
> On Thu, Nov 22, 2018 at 01:36:49PM +0100, Tom de Vries wrote:
>> Hi,
>>
>> When backtrace_vector_release is called with vec.size == 0, it releases the
>> memory pointed at by vec.base.
>>
>> In case of the backtrace_vector_release in alloc.c, vec.base may then be set
>> to NULL, but this is not guaranteed.
>>
>> Set vec.base set to NULL if vec.size == 0 to ensure we don't point to released
>> memory.
>>
>> OK for trunk if bootstrap and reg-test on x86_64 succeeds?
>>
>
> Reposting patch with alloc.c part dropped, now that alloc.c has been rewritten
> to use free instead of realloc with size 0.
>
> OK for trunk?
>
> Thanks,
> - Tom
>
> [libbacktrace] Don't point to released memory in backtrace_vector_release
>
> When backtrace_vector_release is called with vec.size == 0, it releases the
> memory pointed at by vec.base.
>
> Set vec.base set to NULL if vec.size == 0 to ensure we don't point to released
> memory.
>
> Bootstrapped and reg-tested on x86_64.
>
> 2018-11-22 Tom de Vries <tdevries@suse.de>
>
> * mmap.c (backtrace_vector_release): Same.
> * unittest.c (test1): Add check.
Looks like this one still is relevant :-)
OK
jeff