s = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, adjust_text, s);\r
\r
while (s >= text) {\r
+ //if text is not null,the logic is correct.\r
+ //this function is only invoked by backward_search_range,parameter text come\r
+ //from range, which is checked by "if (range == 0) goto fail" in line 4512\r
+ //so the check is just for passing static analysis.\r
+ if(IS_NULL(s))break;\r
if (*s == *target) {\r
p = s + 1;\r
t = target + 1;\r
const UChar *s = text_start;\r
\r
while (s >= text) {\r
+ //if text is not null,the logic is correct.\r
+ //this function is only invoked by backward_search_range,parameter text come\r
+ //from range, which is checked by "if (range == 0) goto fail" in line 4512\r
+ //so the check is just for passing static analysis.\r
+ if(IS_NULL(s))break;\r
if (map[*s]) return (UChar* )s;\r
\r
s = onigenc_get_prev_char_head(enc, adjust_text, s);\r
UChar** low, UChar** high)\r
{\r
UChar *p;\r
-\r
+ if (range == 0) goto fail;\r
range += reg->dmin;\r
p = s;\r
\r
case ANCHOR_BEGIN_LINE:\r
if (!ON_STR_BEGIN(p)) {\r
prev = onigenc_get_prev_char_head(reg->enc, str, p);\r
- if (!ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end)) {\r
+ if (IS_NOT_NULL(prev) && !ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end)) {\r
p = prev;\r
goto retry;\r
}\r
}\r
}\r
else if (reg->anchor & ANCHOR_SEMI_END_BUF) {\r
+\r
UChar* pre_end = ONIGENC_STEP_BACK(reg->enc, str, end, 1);\r
\r
max_semi_end = (UChar* )end;\r
- if (ONIGENC_IS_MBC_NEWLINE(reg->enc, pre_end, end)) {\r
+ // only when str > end, pre_end will be null\r
+ // line 4659 "if (start > end || start < str) goto mismatch_no_msa"\r
+ // will guarantee str alwayls less than end\r
+ // so pre_end won't be null,this check is just for passing staic analysis\r
+ if (IS_NOT_NULL(pre_end) && ONIGENC_IS_MBC_NEWLINE(reg->enc, pre_end, end)) {\r
min_semi_end = pre_end;\r
\r
#ifdef USE_CRNL_AS_LINE_TERMINATOR\r
MATCH_AND_RETURN_CHECK(orig_start);\r
s = prev;\r
}\r
+ // if range is not null,the check is not necessary.\r
+ // the range is actually the pointer of the end of the matched string\r
+ // or assigned by "range = str" in line 4708. In RegularExpressionMatch\r
+ // protocol, the matched string is the parameter String. And str in\r
+ // line 4708 is the String,too. and the range is calculated from\r
+ // "Start + onigenc_str_bytelen_null (CHAR16_ENCODING, Start)" in\r
+ // line 146 in RegularExpressionDxe.c. RegularExpressionMatch ensure\r
+ // the String is not null,So in both situation, the range can not be NULL.\r
+ // This check is just for passing static analysis.\r
+ if(IS_NULL(s))break;\r
} while (s >= range);\r
goto mismatch;\r
}\r