summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorHugo van der Sanden <hv@crypt.org>2019-03-25 11:27:12 +0000
committerHugo van der Sanden <hv@crypt.org>2019-03-27 13:11:55 +0000
commitfd8def15a58c97aa89cce8569befded97fd8c3b7 (patch)
tree58ab8adfe374976ec82d695cabd2ec16489d43f6 /regexec.c
parent5e6a22d7364217775613ba7a991efcc1c7152e9f (diff)
downloadperl-fd8def15a58c97aa89cce8569befded97fd8c3b7.tar.gz
[perl #133892] coredump in Perl_re_intuit_start
Make sure we have a valid non-utf8 'other' check substring before we try to use it.
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/regexec.c b/regexec.c
index 9d67da614e..ad589e285f 100644
--- a/regexec.c
+++ b/regexec.c
@@ -1173,8 +1173,8 @@ Perl_re_intuit_start(pTHX_
/* now look for the 'other' substring if defined */
- if (utf8_target ? prog->substrs->data[other_ix].utf8_substr
- : prog->substrs->data[other_ix].substr)
+ if (prog->substrs->data[other_ix].utf8_substr
+ || prog->substrs->data[other_ix].substr)
{
/* Take into account the "other" substring. */
char *last, *last1;
@@ -1184,6 +1184,11 @@ Perl_re_intuit_start(pTHX_
do_other_substr:
other = &prog->substrs->data[other_ix];
+ if (!utf8_target && !other->substr) {
+ if (!to_byte_substr(prog)) {
+ NON_UTF8_TARGET_BUT_UTF8_REQUIRED(fail);
+ }
+ }
/* if "other" is anchored:
* we've previously found a floating substr starting at check_at.