Re: [pcre-dev] PCRE2 10.30-RC1 test release

Top Page
Delete this message
Author: Petr Pisar
Date:  
To: pcre-dev
Subject: Re: [pcre-dev] PCRE2 10.30-RC1 test release
On Thu, Jul 20, 2017 at 11:21:41AM +0200, Petr Pisar via Pcre-dev wrote:
> On Wed, Jul 19, 2017 at 05:12:39PM +0100, ph10@??? wrote:
> > I have just put the tarballs for the 10.30-RC1 test release in the usual
> > place:
> >
> libpcre2-8.so.0 library (as well as 16- and 32-bit variants) removed
> pcre2_set_recursion_limit_8 symbol (as well as the variants). This makes the
> library ABI incompatible and the library SONAME must change.
>

[...]
> you could define the pcre2_set_recursion_limi() function the library as
> a wrapper on top of pcre2_set_depth_limit() (or use some linker magic
> or provide na alias). Then the library would preserve ABI and the SONAME could
> be preserved.
>

The attached patch adds pcre2_set_recursion_limit() back to the library.

-- Petr
From 2026c0f3985139e7d808dd27bb22fc070e29c44b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@???>
Date: Thu, 20 Jul 2017 12:44:11 +0200
Subject: [PATCH] Define pcre2_set_recursion_limit() in the library
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

To preseve ABI, provide pcre2_set_recursion_limit_* symbols by the
library.

Signed-off-by: Petr Písař <ppisar@???>
---
 src/pcre2.h.generic | 4 +++-
 src/pcre2.h.in      | 4 +++-
 src/pcre2_context.c | 6 ++++++
 3 files changed, 12 insertions(+), 2 deletions(-)


diff --git a/src/pcre2.h.generic b/src/pcre2.h.generic
index 7cafb4c..287b12a 100644
--- a/src/pcre2.h.generic
+++ b/src/pcre2.h.generic
@@ -489,6 +489,8 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
   pcre2_set_offset_limit(pcre2_match_context *, PCRE2_SIZE); \
 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
+  pcre2_set_recursion_limit(pcre2_match_context *, uint32_t); \
+PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
   pcre2_set_recursion_memory_management(pcre2_match_context *, \
     void *(*)(PCRE2_SIZE, void *), void (*)(void *, void *), void *);


@@ -760,7 +762,7 @@ pcre2_compile are called by application code. */
 #define pcre2_substring_number_from_name      PCRE2_SUFFIX(pcre2_substring_number_from_name_)


/* Keep this old function name for backwards compatibility */
-#define pcre2_set_recursion_limit pcre2_set_depth_limit
+#define pcre2_set_recursion_limit PCRE2_SUFFIX(pcre2_set_recursion_limit_)

 /* Keep this obsolete function for backwards compatibility: it is now a noop. */
 #define pcre2_set_recursion_memory_management PCRE2_SUFFIX(pcre2_set_recursion_memory_management_)
diff --git a/src/pcre2.h.in b/src/pcre2.h.in
index 399ddcd..4a8e126 100644
--- a/src/pcre2.h.in
+++ b/src/pcre2.h.in
@@ -489,6 +489,8 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
   pcre2_set_offset_limit(pcre2_match_context *, PCRE2_SIZE); \
 PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
+  pcre2_set_recursion_limit(pcre2_match_context *, uint32_t); \
+PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
   pcre2_set_recursion_memory_management(pcre2_match_context *, \
     void *(*)(PCRE2_SIZE, void *), void (*)(void *, void *), void *);


@@ -760,7 +762,7 @@ pcre2_compile are called by application code. */
 #define pcre2_substring_number_from_name      PCRE2_SUFFIX(pcre2_substring_number_from_name_)


/* Keep this old function name for backwards compatibility */
-#define pcre2_set_recursion_limit pcre2_set_depth_limit
+#define pcre2_set_recursion_limit PCRE2_SUFFIX(pcre2_set_recursion_limit_)

/* Keep this obsolete function for backwards compatibility: it is now a noop. */
#define pcre2_set_recursion_memory_management PCRE2_SUFFIX(pcre2_set_recursion_memory_management_)
diff --git a/src/pcre2_context.c b/src/pcre2_context.c
index 9e557da..898f363 100644
--- a/src/pcre2_context.c
+++ b/src/pcre2_context.c
@@ -435,6 +435,12 @@ return 0;
backwards compatibility. */

PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
+pcre2_set_recursion_limit(pcre2_match_context *mcontext, uint32_t limit)
+{
+return pcre2_set_depth_limit(mcontext, limit);
+}
+
+PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_recursion_memory_management(pcre2_match_context *mcontext,
void *(*mymalloc)(size_t, void *), void (*myfree)(void *, void *),
void *mydata)
--
2.9.4