1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fixed shorten-64-to-32 errors when USE_COMBINATION_EXPLOSION_CHECK

This commit is contained in:
Nobuyoshi Nakada 2021-05-07 18:41:48 +09:00
parent ff69ef27b0
commit 40612d55c6
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
2 changed files with 4 additions and 6 deletions

View file

@ -3755,10 +3755,8 @@ setup_comb_exp_check(Node* node, int state, ScanEnv* env)
switch (type) { switch (type) {
case NT_LIST: case NT_LIST:
{ {
Node* prev = NULL_NODE;
do { do {
r = setup_comb_exp_check(NCAR(node), r, env); r = setup_comb_exp_check(NCAR(node), r, env);
prev = NCAR(node);
} while (r >= 0 && IS_NOT_NULL(node = NCDR(node))); } while (r >= 0 && IS_NOT_NULL(node = NCDR(node)));
} }
break; break;

View file

@ -601,7 +601,7 @@ stack_double(OnigStackType** arg_stk_base, OnigStackType** arg_stk_end,
(((s) - str) * num_comb_exp_check + ((snum) - 1)) (((s) - str) * num_comb_exp_check + ((snum) - 1))
# define STATE_CHECK_VAL(v,snum) do {\ # define STATE_CHECK_VAL(v,snum) do {\
if (state_check_buff != NULL) {\ if (state_check_buff != NULL) {\
int x = STATE_CHECK_POS(s,snum);\ ptrdiff_t x = STATE_CHECK_POS(s,snum);\
(v) = state_check_buff[x/8] & (1<<(x%8));\ (v) = state_check_buff[x/8] & (1<<(x%8));\
}\ }\
else (v) = 0;\ else (v) = 0;\
@ -610,7 +610,7 @@ stack_double(OnigStackType** arg_stk_base, OnigStackType** arg_stk_end,
# define ELSE_IF_STATE_CHECK_MARK(stk) \ # define ELSE_IF_STATE_CHECK_MARK(stk) \
else if ((stk)->type == STK_STATE_CHECK_MARK) { \ else if ((stk)->type == STK_STATE_CHECK_MARK) { \
int x = STATE_CHECK_POS(stk->u.state.pstr, stk->u.state.state_check);\ ptrdiff_t x = STATE_CHECK_POS(stk->u.state.pstr, stk->u.state.state_check);\
state_check_buff[x/8] |= (1<<(x%8)); \ state_check_buff[x/8] |= (1<<(x%8)); \
} }
@ -3873,7 +3873,7 @@ onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at, On
MATCH_ARG_INIT(msa, option, region, at, at); MATCH_ARG_INIT(msa, option, region, at, at);
#ifdef USE_COMBINATION_EXPLOSION_CHECK #ifdef USE_COMBINATION_EXPLOSION_CHECK
{ {
int offset = at - str; ptrdiff_t offset = at - str;
STATE_CHECK_BUFF_INIT(msa, end - str, offset, reg->num_comb_exp_check); STATE_CHECK_BUFF_INIT(msa, end - str, offset, reg->num_comb_exp_check);
} }
#endif #endif
@ -4352,7 +4352,7 @@ onig_search_gpos(regex_t* reg, const UChar* str, const UChar* end,
MATCH_ARG_INIT(msa, option, region, start, global_pos); MATCH_ARG_INIT(msa, option, region, start, global_pos);
#ifdef USE_COMBINATION_EXPLOSION_CHECK #ifdef USE_COMBINATION_EXPLOSION_CHECK
{ {
int offset = (MIN(start, range) - str); ptrdiff_t offset = (MIN(start, range) - str);
STATE_CHECK_BUFF_INIT(msa, end - str, offset, reg->num_comb_exp_check); STATE_CHECK_BUFF_INIT(msa, end - str, offset, reg->num_comb_exp_check);
} }
#endif #endif