mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 12:14:51 +00:00
[k-takata/Onigmo] Fix stack overflow with X+++++++++++++++++++…
Imported the fix from:
4097828d7c
https://github.com/k-takata/Onigmo/commit/786b4849c1
This commit is contained in:
parent
f0b31a5898
commit
ac379278e8
Notes:
git
2026-01-12 12:35:30 +00:00
@ -6313,11 +6313,14 @@ parse_exp(Node** np, OnigToken* tok, int term,
|
||||
int r, len, group = 0;
|
||||
Node* qn;
|
||||
Node** targetp;
|
||||
unsigned int parse_depth;
|
||||
|
||||
*np = NULL;
|
||||
if (tok->type == (enum TokenSyms )term)
|
||||
goto end_of_token;
|
||||
|
||||
parse_depth = env->parse_depth;
|
||||
|
||||
switch (tok->type) {
|
||||
case TK_ALT:
|
||||
case TK_EOT:
|
||||
@ -6628,6 +6631,10 @@ parse_exp(Node** np, OnigToken* tok, int term,
|
||||
if (is_invalid_quantifier_target(*targetp))
|
||||
return ONIGERR_TARGET_OF_REPEAT_OPERATOR_INVALID;
|
||||
|
||||
parse_depth++;
|
||||
if (parse_depth > ParseDepthLimit)
|
||||
return ONIGERR_PARSE_DEPTH_LIMIT_OVER;
|
||||
|
||||
qn = node_new_quantifier(tok->u.repeat.lower, tok->u.repeat.upper,
|
||||
(r == TK_INTERVAL ? 1 : 0));
|
||||
CHECK_NULL_RETURN_MEMERR(qn);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user