changeset 23817:d9ca3f15f739

maint: Periodic merge of stable to default.
author Rik <rik@octave.org>
date Mon, 31 Jul 2017 16:25:19 -0700
parents 4d11ada80395 (current diff) d396866fa7d8 (diff)
children 784347c1b7e7
files libinterp/corefcn/regexp.cc
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/regexp.cc	Mon Jul 31 13:48:13 2017 -0700
+++ b/libinterp/corefcn/regexp.cc	Mon Jul 31 16:25:19 2017 -0700
@@ -837,6 +837,18 @@
 are zero or more @qcode{'b'} characters at positions 1 and end-of-string.
 
 @end table
+Stack Limitation Note: Pattern searches are done with a recursive function
+which can overflow the program stack when there are a high number of matches.
+For example,
+
+@example
+@code{regexp (repmat ('a', 1, 1e5), '(a)+')}
+@end example
+
+may lead to a segfault.  As an alternative, consider constructing pattern
+searches that reduce the number of matches (e.g., by creatively using set
+complement), and then further processing the return variables (now reduced in
+size) with successive @code{regexp} searches.
 @seealso{regexpi, strfind, regexprep}
 @end deftypefn */)
 {