Give match data memory failur in regcomp() instead of regexec()
This commit is contained in:
parent
8d70b1d368
commit
2f8febd4b1
|
@ -293,6 +293,9 @@ a factor of the size of the compiling workspace (it currently is).
|
|||
86. Avoid the possibility of computing with an out-of-bounds pointer (though
|
||||
not dereferencing it) while handling lookbehind assertions.
|
||||
|
||||
87. Failure to get memory for the match data in regcomp() is now given as a
|
||||
regcomp() error instead of waiting for regexec() to pick it up.
|
||||
|
||||
|
||||
Version 10.20 30-June-2015
|
||||
--------------------------
|
||||
|
|
|
@ -231,6 +231,13 @@ if (preg->re_pcre2_code == NULL)
|
|||
preg->re_nsub = (size_t)re_nsub;
|
||||
if ((options & PCRE2_NO_AUTO_CAPTURE) != 0) re_nsub = -1;
|
||||
preg->re_match_data = pcre2_match_data_create(re_nsub + 1, NULL);
|
||||
|
||||
if (preg->re_match_data == NULL)
|
||||
{
|
||||
pcre2_code_free(preg->re_pcre2_code);
|
||||
return REG_ESPACE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -4597,6 +4597,9 @@ if ((pat_patctl.control & CTL_POSIX) != 0)
|
|||
{
|
||||
size_t bsize, usize;
|
||||
|
||||
preg.re_pcre2_code = NULL; /* In case something was left in there */
|
||||
preg.re_match_data = NULL;
|
||||
|
||||
bsize = (pat_patctl.regerror_buffsize != 0)?
|
||||
pat_patctl.regerror_buffsize : pbuffer8_size;
|
||||
if (bsize + 8 < pbuffer8_size)
|
||||
|
|
Loading…
Reference in New Issue