summaryrefslogtreecommitdiff
path: root/regcomp.h
diff options
context:
space:
mode:
authorAndy Dougherty <doughera@lafayette.edu>1998-06-11 07:50:07 -0400
committerGurusamy Sarathy <gsar@cpan.org>1998-06-11 17:42:07 +0000
commit9c7e81e8284418a8170662b2b8ec04f26145e65e (patch)
tree2ad052b8426ff6187d3e318bcc2460aabf80f489 /regcomp.h
parent0230bf3c00594be1cf44d397b673991c9bbde7f9 (diff)
downloadperl-9c7e81e8284418a8170662b2b8ec04f26145e65e.tar.gz
make REG_INFTY default to something saner when sizeof(short) > 2
Message-Id: <Pine.SUN.3.96.980611114241.18493H-100000@newton.phys> Subject: Re: [PATCH for tests] Regexp fails on long string p4raw-id: //depot/perl@1119
Diffstat (limited to 'regcomp.h')
-rw-r--r--regcomp.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/regcomp.h b/regcomp.h
index 7b0a12eb3a..c9742e878a 100644
--- a/regcomp.h
+++ b/regcomp.h
@@ -271,7 +271,25 @@ struct regnode_2 {
#endif
-#ifndef
+/* XXX fix this description.
+ Impose a limit of REG_INFTY on various pattern matching operations
+ to limit stack growth and to avoid "infinite" recursions.
+*/
+/* The default size for REG_INFTY is I16_MAX, which is the same as
+ SHORT_MAX (see perl.h). Unfortunately I16 isn't necessarily 16 bits
+ (see handy.h). On the Cray C90, sizeof(short)==4 and hence I16_MAX is
+ ((1<<31)-1), while on the Cray T90, sizeof(short)==8 and I16_MAX is
+ ((1<<63)-1). To limit stack growth to reasonable sizes, supply a
+ smaller default.
+ --Andy Dougherty 11 June 1998
+*/
+#if SHORTSIZE > 2
+# ifndef REG_INFTY
+# define REG_INFTY ((1<<15)-1)
+# endif
+#endif
+
+#ifndef REG_INFTY
# define REG_INFTY I16_MAX
#endif
@@ -453,4 +471,3 @@ const static char reg_off_by_arg[] = {
#define REG_SEEN_LOOKBEHIND 2
#define REG_SEEN_GPOS 4
#define REG_SEEN_EVAL 8
-