summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjvoisin2021-05-08 16:14:49 +0200
committerjvoisin2021-05-08 16:14:49 +0200
commit916a9d755a1660e086ef66d7113c2bcfc808a557 (patch)
treeb1a81bdc920d33dafaa1414eb7820b554add7edb /src
parent3babf77bb88c6dbd465e83b6da5946f273c890c1 (diff)
Handle a possible issue with regexp
Gracefully handle the case where we can't get allocated memory when trying to match a regex.
Diffstat (limited to 'src')
-rw-r--r--src/sp_pcre_compat.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/sp_pcre_compat.c b/src/sp_pcre_compat.c
index 509a8ea..0d19769 100644
--- a/src/sp_pcre_compat.c
+++ b/src/sp_pcre_compat.c
@@ -34,6 +34,9 @@ bool ZEND_HOT sp_is_regexp_matching_len(const sp_pcre* regexp, const char* str,
34#ifdef SP_HAS_PCRE2 34#ifdef SP_HAS_PCRE2
35 pcre2_match_data* match_data = 35 pcre2_match_data* match_data =
36 pcre2_match_data_create_from_pattern(regexp, NULL); 36 pcre2_match_data_create_from_pattern(regexp, NULL);
37 if (NULL == match_data) {
38 sp_log_err("regexp", "Unable to get memory for a regxp.");
39 }
37 ret = pcre2_match(regexp, (PCRE2_SPTR)str, len, 0, 0, match_data, NULL); 40 ret = pcre2_match(regexp, (PCRE2_SPTR)str, len, 0, 0, match_data, NULL);
38#else 41#else
39 int vec[30]; 42 int vec[30];