Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: e25d382dc080b3650485725b8ba89f4b64160917
      
https://github.com/Perl/perl5/commit/e25d382dc080b3650485725b8ba89f4b64160917
  Author: Richard Leach <[email protected]>
  Date:   2026-08-18 (Tue, 18 Aug 2026)

  Changed paths:
    M hv.c

  Log Message:
  -----------
  Verify whether a shared KEY came from PL_strtab before bumping refcount

https://github.com/Perl/perl5/commit/823fa88ebd51f2c7d55e978d5881cf33e1e64508
attempted to avoid a seemingly-unnecessary call to `share_hek_flags()`
when inserting a shared HEK into a hash. (Bumping the refcount instead.)

The underlying assumption was that the shared HEK - being a shared HEK -
must already be in the current interpreter's `PL_strtab`.

However, thread-unsafe XS code may pass a HEK, shared in one thread's
`PL_strtab`, to a different thread. `share_hek_flags()` covers over
any unsafe/lack of thread context handling, but directly bumping the
underlying refcount acts on the originating thread's `PL_strtab`,
not the receiving thread's version.

This commit adds a pointer-comparison walk of the relevant bucket
in the _current_ `PL_strtab` to check if the shared HEK is present
and falls back to `share_hek_flags()` if not.



To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to