Branch: refs/heads/smoke-me/tonyc/21661-no-warn-ck
  Home:   https://github.com/Perl/perl5
  Commit: 80c17cc134eaeddd0f4b244925b21b222a16828e
      
https://github.com/Perl/perl5/commit/80c17cc134eaeddd0f4b244925b21b222a16828e
  Author: Tony Cook <t...@develop-help.com>
  Date:   2023-11-30 (Thu, 30 Nov 2023)

  Changed paths:
    M t/re/pat.t

  Log Message:
  -----------
  add tests for #21661


  Commit: 659ff22d9e1d313fbf78793c9a180ded94748976
      
https://github.com/Perl/perl5/commit/659ff22d9e1d313fbf78793c9a180ded94748976
  Author: Tony Cook <t...@develop-help.com>
  Date:   2023-11-30 (Thu, 30 Nov 2023)

  Changed paths:
    M regcomp.c
    M regcomp_internal.h

  Log Message:
  -----------
  safer cleanup when failing to compile regexps

Prior to this commit when producing a warning the regexp compiler
would check if the warning was marked as FATAL, and if it was it
would add clean up to the save stack to release buffers used
during compilation and to release the working REGEXP SV.

This cause two type of problems:

- if an error was already queued, Perl_ck_warner() returns even if
  the warning is fatal, this meant that the normal clean up code
  Perl_re_op_compile() would also run, resulting in a double free
  of the buffers.

- without fatal warnings, if a $SIG{__WARN__} handler died, the
  buffers and the working REGEXP SV would leak.

Workaround this by using SAVEDESTRUCTOR_X() to release the memory
and optionally the SV at the end of scope.

Fixes #21661


Compare: https://github.com/Perl/perl5/compare/cf0a1dd00724...659ff22d9e1d

Reply via email to