Branch: refs/heads/smoke-me/tonyc/21661-no-warn-ck
  Home:   https://github.com/Perl/perl5
  Commit: a28a6c184ced58a358f2bb28efebd8eabafa005e
      
https://github.com/Perl/perl5/commit/a28a6c184ced58a358f2bb28efebd8eabafa005e
  Author: Tony Cook <t...@develop-help.com>
  Date:   2023-12-04 (Mon, 04 Dec 2023)

  Changed paths:
    M t/re/pat.t

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


  Commit: 72efebc0b5e4d07ff8bb47c2f7478ceda031dca3
      
https://github.com/Perl/perl5/commit/72efebc0b5e4d07ff8bb47c2f7478ceda031dca3
  Author: Tony Cook <t...@develop-help.com>
  Date:   2023-12-04 (Mon, 04 Dec 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 category 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 causes 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.

Avoid 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/659ff22d9e1d...72efebc0b5e4

Reply via email to