File 1263-erts-pcre-uplift-8.44-to-8.45.patch of Package erlang

From a06dbbe7ff7a0f83665a0eaea9a818290d8ad0d7 Mon Sep 17 00:00:00 2001
From: Fredrik Frantzen <frazze@erlang.org>
Date: Mon, 31 Mar 2025 10:44:03 +0200
Subject: [PATCH] erts: pcre uplift 8.44 to 8.45

---
 erts/emulator/pcre/LICENCE                | 10 +++++-----
 erts/emulator/pcre/local_config.h         |  2 +-
 erts/emulator/pcre/pcre.h                 |  4 ++--
 erts/emulator/pcre/pcre_compile.c         |  9 ++++++---
 erts/emulator/pcre/pcre_exec.c            |  4 ++--
 lib/stdlib/test/re_SUITE_data/testoutput1 |  5 +++++
 system/COPYRIGHT                          | 12 ++++++------
 7 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/erts/emulator/pcre/LICENCE b/erts/emulator/pcre/LICENCE
index 57a544814c..803b4119e5 100644
--- a/erts/emulator/pcre/LICENCE
+++ b/erts/emulator/pcre/LICENCE
@@ -19,13 +19,13 @@ THE BASIC LIBRARY FUNCTIONS
 ---------------------------
 
 Written by:       Philip Hazel
-Email local part: ph10
-Email domain:     cam.ac.uk
+Email local part: Philip.Hazel
+Email domain:     gmail.com
 
 University of Cambridge Computing Service,
 Cambridge, England.
 
-Copyright (c) 1997-2020 University of Cambridge
+Copyright (c) 1997-2021 University of Cambridge
 All rights reserved.
 
 
@@ -36,7 +36,7 @@ Written by:       Zoltan Herczeg
 Email local part: hzmester
 Email domain:     freemail.hu
 
-Copyright(c) 2010-2020 Zoltan Herczeg
+Copyright(c) 2010-2021 Zoltan Herczeg
 All rights reserved.
 
 
@@ -47,7 +47,7 @@ Written by:       Zoltan Herczeg
 Email local part: hzmester
 Email domain:     freemail.hu
 
-Copyright(c) 2009-2020 Zoltan Herczeg
+Copyright(c) 2009-2021 Zoltan Herczeg
 All rights reserved.
 
 
diff --git a/erts/emulator/pcre/local_config.h b/erts/emulator/pcre/local_config.h
index 6f4f3a1868..d5fe875312 100644
--- a/erts/emulator/pcre/local_config.h
+++ b/erts/emulator/pcre/local_config.h
@@ -83,4 +83,4 @@
 #define SUPPORT_UTF 
 
 /* Version number of package */
-#define VERSION "8.44"
+#define VERSION "8.45"
diff --git a/erts/emulator/pcre/pcre.h b/erts/emulator/pcre/pcre.h
index c33c93b720..0990e5e021 100644
--- a/erts/emulator/pcre/pcre.h
+++ b/erts/emulator/pcre/pcre.h
@@ -43,9 +43,9 @@ POSSIBILITY OF SUCH DAMAGE.
 /* The current PCRE version information. */
 
 #define PCRE_MAJOR          8
-#define PCRE_MINOR          44
+#define PCRE_MINOR          45
 #define PCRE_PRERELEASE     
-#define PCRE_DATE           2020-02-12
+#define PCRE_DATE           2021-06-15
 
 /* When an application links to a PCRE DLL in Windows, the symbols that are
 imported have to be identified as such. When building PCRE, the appropriate
diff --git a/erts/emulator/pcre/pcre_compile.c b/erts/emulator/pcre/pcre_compile.c
index 94a7222e4d..1593753bcd 100644
--- a/erts/emulator/pcre/pcre_compile.c
+++ b/erts/emulator/pcre/pcre_compile.c
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2020 University of Cambridge
+           Copyright (c) 1997-2021 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -9117,6 +9117,8 @@ pcre_uchar cworkspace[COMPILE_WORK_SIZE];
 similar way to cworkspace, it can be expanded using malloc() if necessary. */
 
 named_group named_groups[NAMED_GROUP_LIST_SIZE];
+cd->named_groups = named_groups;
+cd->named_group_list_size = NAMED_GROUP_LIST_SIZE;
 
 /* Set this early so that early errors get offset 0. */
 
@@ -9390,8 +9392,6 @@ cd->hwm = cworkspace;
 cd->iscondassert = FALSE;
 cd->start_workspace = cworkspace;
 cd->workspace_size = COMPILE_WORK_SIZE;
-cd->named_groups = named_groups;
-cd->named_group_list_size = NAMED_GROUP_LIST_SIZE;
 cd->start_pattern = (const pcre_uchar *)pattern;
 cd->end_pattern = (const pcre_uchar *)(pattern + STRLEN_UC((const pcre_uchar *)pattern));
 cd->req_varyopt = 0;
@@ -9502,6 +9502,7 @@ if (cd->names_found > 0)
     add_name(cd, ng->name, ng->length, ng->number);
   if (cd->named_group_list_size > NAMED_GROUP_LIST_SIZE)
     (PUBL(free))((void *)cd->named_groups);
+    cd->named_group_list_size = 0;   /* So we don't free it twice */
   }
 
 /* Set up a starting, non-extracting bracket, then compile the expression. On
@@ -9652,6 +9653,8 @@ if (errorcode != 0)
   {
   (PUBL(free))(re);
   PCRE_EARLY_ERROR_RETURN:
+  if (cd->named_group_list_size > NAMED_GROUP_LIST_SIZE)
+    (PUBL(free))((void *)cd->named_groups);
   *erroroffset = (int)(ptr - (const pcre_uchar *)pattern);
   PCRE_EARLY_ERROR_RETURN2:
   *errorptr = find_error_text(errorcode);
diff --git a/erts/emulator/pcre/pcre_exec.c b/erts/emulator/pcre/pcre_exec.c
index ca080e3513..72a49ba61e 100644
--- a/erts/emulator/pcre/pcre_exec.c
+++ b/erts/emulator/pcre/pcre_exec.c
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.
 
                        Written by Philip Hazel
-           Copyright (c) 1997-2018 University of Cambridge
+           Copyright (c) 1997-2021 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -846,7 +846,7 @@ for (;;)
     md->mark = NULL;    /* In case previously set by assertion */
     RMATCH(eptr, ecode + PRIV(OP_lengths)[*ecode] + ecode[1], offset_top, md,
       eptrb, RM55);
-    if ((rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) &&
+    if ((rrc == MATCH_MATCH || rrc == MATCH_ACCEPT || rrc == MATCH_KETRPOS) &&
          md->mark == NULL) md->mark = ecode + 2;
 
     /* A return of MATCH_SKIP_ARG means that matching failed at SKIP with an
diff --git a/lib/stdlib/test/re_SUITE_data/testoutput1 b/lib/stdlib/test/re_SUITE_data/testoutput1
index e6147e60b9..212dafaae5 100644
--- a/lib/stdlib/test/re_SUITE_data/testoutput1
+++ b/lib/stdlib/test/re_SUITE_data/testoutput1
@@ -9470,4 +9470,9 @@ No match
  0: pokus.hokus
  1: hokus
 
+/(?:A(*:X))*+/K
+    A
+ 0: A
+MK: X
+
 /-- End of testinput1 --/
diff --git a/system/COPYRIGHT b/system/COPYRIGHT
index a2fdfbfe7d..1943a851ef 100644
--- a/system/COPYRIGHT
+++ b/system/COPYRIGHT
@@ -248,7 +248,7 @@ freely, subject to the following restrictions:
 * Info:
   * SPDX-License-Identifier: BSD-3-Clause
   * Library: PCRE
-  * Version: 8.44
+  * Version: 8.45
   * Website: https://pcre.org
   * OTP Location: ./erts/emulator/pcre
 
@@ -273,13 +273,13 @@ THE BASIC LIBRARY FUNCTIONS
 ---------------------------
 
 Written by:       Philip Hazel
-Email local part: ph10
-Email domain:     cam.ac.uk
+Email local part: Philip.Hazel
+Email domain:     gmail.com
 
 University of Cambridge Computing Service,
 Cambridge, England.
 
-Copyright (c) 1997-2020 University of Cambridge
+Copyright (c) 1997-2021 University of Cambridge
 All rights reserved.
 
 
@@ -290,7 +290,7 @@ Written by:       Zoltan Herczeg
 Email local part: hzmester
 Email domain:     freemail.hu
 
-Copyright(c) 2010-2020 Zoltan Herczeg
+Copyright(c) 2010-2021 Zoltan Herczeg
 All rights reserved.
 
 
@@ -301,7 +301,7 @@ Written by:       Zoltan Herczeg
 Email local part: hzmester
 Email domain:     freemail.hu
 
-Copyright(c) 2009-2020 Zoltan Herczeg
+Copyright(c) 2009-2021 Zoltan Herczeg
 All rights reserved.
 
 
-- 
2.43.0

openSUSE Build Service is sponsored by