[Ada] fix potential memory corruption in annotated value cache
Eric Botcazou
ebotcazou@adacore.com
Fri Sep 16 21:04:00 GMT 2011
> Some possible fixes I considered were:
>
> 1. inserting on entry (as is), allocating the cache entry right away,
> and *always* filling it before returning
>
> 2. inserting on entry (as is), allocating the cache entry right away,
> and releasing it before returning unless we're filling it in
>
> 3. not inserting on entry, and looking up again for insertion before
> caching and returning, so as to get a fresh slot pointer
>
> I implemented 3., and considered splitting the logic of annotate_value()
> into one function that manages caching and calls the other to perform
> the computation, so as to simplify the implementation.
This looks like the most straightforward solution indeed.
> Here's the patch I've tested on i686-pc-linux-gnu and x86_64-linux-gnu.
> Ok to install?
Yes, modulo Jakub's remark and s/NULL/NULL_TREE for zeroing in.base.from.
--
Eric Botcazou
More information about the Gcc-patches
mailing list