From: K.Kosako Date: Thu, 7 Feb 2019 04:20:12 +0000 (+0900) Subject: check next opcode after empty check if ONIG_DEBUG is enabled. X-Git-Tag: v6.9.2_rc1~65^2~60 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0486a4d7199f1b24734aae1e030cf022e893e6ae;p=onig check next opcode after empty check if ONIG_DEBUG is enabled. --- diff --git a/src/regexec.c b/src/regexec.c index be3c387..b5c2b8d 100644 --- a/src/regexec.c +++ b/src/regexec.c @@ -3642,7 +3642,24 @@ match_at(regex_t* reg, const UChar* str, const UChar* end, fprintf(stderr, "EMPTY_CHECK_END: skip id:%d, s:%p\n", (int )mem, s); #endif empty_check_found: + /* empty loop founded, skip next instruction */ +#if defined(ONIG_DEBUG) && !defined(USE_DIRECT_THREADED_CODE) + switch (p->opcode) { + case OP_JUMP: + case OP_PUSH: + case OP_REPEAT_INC: + case OP_REPEAT_INC_NG: + case OP_REPEAT_INC_SG: + case OP_REPEAT_INC_NG_SG: + INC_OP; + break; + default: + goto unexpected_bytecode_error; + break; + } +#else INC_OP; +#endif } } JUMP_OUT; @@ -4079,6 +4096,12 @@ match_at(regex_t* reg, const UChar* str, const UChar* end, STACK_SAVE; return ONIGERR_UNDEFINED_BYTECODE; +#if defined(ONIG_DEBUG) && !defined(USE_DIRECT_THREADED_CODE) + unexpected_bytecode_error: + STACK_SAVE; + return ONIGERR_UNEXPECTED_BYTECODE; +#endif + #ifdef USE_RETRY_LIMIT_IN_MATCH retry_limit_in_match_over: STACK_SAVE;