From 9c7e81e8284418a8170662b2b8ec04f26145e65e Mon Sep 17 00:00:00 2001 From: Andy Dougherty Date: Thu, 11 Jun 1998 07:50:07 -0400 Subject: make REG_INFTY default to something saner when sizeof(short) > 2 Message-Id: Subject: Re: [PATCH for tests] Regexp fails on long string p4raw-id: //depot/perl@1119 --- regcomp.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'regcomp.h') 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 - -- cgit v1.2.1