[PATCH] Fix heap-use-after-free in index-cached with --disable-threading

Hannes Domani ssbssa@yahoo.de
Sat May 4 16:28:45 GMT 2024


 Am Samstag, 4. Mai 2024 um 17:45:06 MESZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:

> >>>>> "Hannes" == Hannes Domani <ssbssa@yahoo.de> writes:
>
> Hannes>  #else
> Hannes>    /* Without threads, all the work is done immediately on the main
> Hannes>      thread, and there is never anything to wait for.  */
> Hannes> -  done = true;
> Hannes> +  done = desired_state == cooked_state::CACHE_DONE;
> Hannes>  #endif /* CXX_STD_THREAD */
>
> I wouldn't mind if this code were lowered out of the #if, like:
>
>
>     #endif /* CXX_STD_THREAD */
>
>       bool done = ...
>
> However I think it's also fine as-is and can be tidied up later if
> anyone cares to.

Note that there is a small difference between them:

#if CXX_STD_THREAD
  done = m_state == cooked_state::CACHE_DONE;
#else
  done = desired_state == cooked_state::CACHE_DONE;
#endif

Though I wonder if not both could check for desired_state.


Hannes


More information about the Gdb-patches mailing list