mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
This commit was generated by cvs2svn to compensate for changes in r6231,
which included commits to RCS files with non-trunk default branches. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4e85c0322a
commit
803279135c
3 changed files with 44 additions and 25 deletions
13
regcomp.c
13
regcomp.c
|
@ -3950,15 +3950,9 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_NULL(cc->mbuf)) {
|
if (! ONIGENC_IS_SINGLEBYTE(env->enc)) {
|
||||||
if (cc->not) {
|
if (! IS_NULL(cc->mbuf) ||
|
||||||
for (i = 0; i < SINGLE_BYTE_SIZE; i++) {
|
(cc->not != 0 && found != 0)) {
|
||||||
add_char_opt_map_info(&opt->map, i);
|
|
||||||
}
|
|
||||||
mb_found = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for (i = 0; i < SINGLE_BYTE_SIZE; i++) {
|
for (i = 0; i < SINGLE_BYTE_SIZE; i++) {
|
||||||
z = ONIGENC_IS_MBC_HEAD(env->enc, i);
|
z = ONIGENC_IS_MBC_HEAD(env->enc, i);
|
||||||
if (z) {
|
if (z) {
|
||||||
|
@ -3967,6 +3961,7 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mb_found) {
|
if (mb_found) {
|
||||||
len = ONIGENC_MBC_MAXLEN_DIST(env->enc);
|
len = ONIGENC_MBC_MAXLEN_DIST(env->enc);
|
||||||
|
|
40
regexec.c
40
regexec.c
|
@ -362,11 +362,26 @@ typedef struct {
|
||||||
};\
|
};\
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
static unsigned int MatchStackLimitSize = DEFAULT_MATCH_STACK_LIMIT_SIZE;
|
||||||
|
|
||||||
|
extern unsigned int
|
||||||
|
onig_get_match_stack_limit_size(void)
|
||||||
|
{
|
||||||
|
return MatchStackLimitSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern int
|
||||||
|
onig_set_match_stack_limit_size(unsigned int size)
|
||||||
|
{
|
||||||
|
MatchStackLimitSize = size;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
stack_double(StackType** arg_stk_base, StackType** arg_stk_end,
|
stack_double(StackType** arg_stk_base, StackType** arg_stk_end,
|
||||||
StackType** arg_stk, StackType* stk_alloc, MatchArg* msa)
|
StackType** arg_stk, StackType* stk_alloc, MatchArg* msa)
|
||||||
{
|
{
|
||||||
int n;
|
unsigned int n;
|
||||||
StackType *x, *stk_base, *stk_end, *stk;
|
StackType *x, *stk_base, *stk_end, *stk;
|
||||||
|
|
||||||
stk_base = *arg_stk_base;
|
stk_base = *arg_stk_base;
|
||||||
|
@ -385,7 +400,12 @@ stack_double(StackType** arg_stk_base, StackType** arg_stk_end,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
n *= 2;
|
n *= 2;
|
||||||
if (n > MATCH_STACK_LIMIT_SIZE) return ONIGERR_MATCH_STACK_LIMIT_OVER;
|
if (MatchStackLimitSize != 0 && n > MatchStackLimitSize) {
|
||||||
|
if ((unsigned int )(stk_end - stk_base) == MatchStackLimitSize)
|
||||||
|
return ONIGERR_MATCH_STACK_LIMIT_OVER;
|
||||||
|
else
|
||||||
|
n = MatchStackLimitSize;
|
||||||
|
}
|
||||||
x = (StackType* )xrealloc(stk_base, sizeof(StackType) * n);
|
x = (StackType* )xrealloc(stk_base, sizeof(StackType) * n);
|
||||||
if (IS_NULL(x)) {
|
if (IS_NULL(x)) {
|
||||||
STACK_SAVE;
|
STACK_SAVE;
|
||||||
|
@ -2573,11 +2593,13 @@ bm_search_notrev(regex_t* reg, UChar* target, UChar* target_end,
|
||||||
if (t < target) return p + 1;
|
if (t < target) return p + 1;
|
||||||
|
|
||||||
skip = reg->map[*s];
|
skip = reg->map[*s];
|
||||||
p++;
|
p = s + 1;
|
||||||
|
if (p >= text_end) return (UChar* )NULL;
|
||||||
t = p;
|
t = p;
|
||||||
while ((p - t) < skip) {
|
do {
|
||||||
p += enc_len(reg->enc, *p);
|
p += enc_len(reg->enc, *p);
|
||||||
}
|
} while ((p - t) < skip && p < text_end);
|
||||||
|
|
||||||
s += (p - t);
|
s += (p - t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2591,11 +2613,13 @@ bm_search_notrev(regex_t* reg, UChar* target, UChar* target_end,
|
||||||
if (t < target) return p + 1;
|
if (t < target) return p + 1;
|
||||||
|
|
||||||
skip = reg->int_map[*s];
|
skip = reg->int_map[*s];
|
||||||
p++;
|
p = s + 1;
|
||||||
|
if (p >= text_end) return (UChar* )NULL;
|
||||||
t = p;
|
t = p;
|
||||||
while ((p - t) < skip) {
|
do {
|
||||||
p += enc_len(reg->enc, *p);
|
p += enc_len(reg->enc, *p);
|
||||||
}
|
} while ((p - t) < skip && p < text_end);
|
||||||
|
|
||||||
s += (p - t);
|
s += (p - t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
regint.h
2
regint.h
|
@ -46,7 +46,7 @@
|
||||||
#define USE_QUALIFIER_PEEK_NEXT
|
#define USE_QUALIFIER_PEEK_NEXT
|
||||||
|
|
||||||
#define INIT_MATCH_STACK_SIZE 160
|
#define INIT_MATCH_STACK_SIZE 160
|
||||||
#define MATCH_STACK_LIMIT_SIZE 500000
|
#define DEFAULT_MATCH_STACK_LIMIT_SIZE 0 /* unlimited */
|
||||||
|
|
||||||
/* interface to external system */
|
/* interface to external system */
|
||||||
#ifdef NOT_RUBY /* gived from Makefile */
|
#ifdef NOT_RUBY /* gived from Makefile */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue