summaryrefslogtreecommitdiffstats
path: root/kjs
diff options
context:
space:
mode:
authorSlávek Banko <[email protected]>2024-09-08 12:20:25 +0200
committerSlávek Banko <[email protected]>2024-09-08 12:24:25 +0200
commit3150a4542f81f0f953e68170bda462b0a501ff29 (patch)
tree73efee082eeb5b4cea29fdb1713dddc01df05e69 /kjs
parent8166c26c7aae21e6851dc72a5b5148aaabd27236 (diff)
downloadtdelibs-3150a4542f81f0f953e68170bda462b0a501ff29.tar.gz
tdelibs-3150a4542f81f0f953e68170bda462b0a501ff29.zip
kjs - pcre: Fix crash if regexp is invalid.
If the regular expression is invalid and pcre2_compile ends with error, match_data will remain uninitialized, which in turn leads to crash on pcre2_match_data_free in RegExp destructor. Signed-off-by: Slávek Banko <[email protected]>
Diffstat (limited to 'kjs')
-rw-r--r--kjs/regexp.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/kjs/regexp.cpp b/kjs/regexp.cpp
index a693fdc1a..c92a69d6a 100644
--- a/kjs/regexp.cpp
+++ b/kjs/regexp.cpp
@@ -149,6 +149,7 @@ RegExp::RegExp(const UString &p, int f)
pcre2_get_error_message(errorCode, errorMsg, sizeof(errorMsg));
fprintf(stderr, "KJS: pcre_compile() failed with '%s'\n", errorMsg);
#endif
+ match_data = nullptr;
valid = false;
return;
}