From fc9ba4264eafbb5a6ec0f3cc4cd2e1964c9b8fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 8 Nov 2020 10:58:30 +0100 Subject: New upstream version 6.9.6 --- test/test_back.c | 10 +++++++++- test/test_regset.c | 11 +++++++++-- test/test_syntax.c | 8 ++++++++ test/test_utf8.c | 35 ++++++++++++++++++++++++++++++++++- test/testc.c | 8 ++++++++ test/testu.c | 14 +++++++++++--- 6 files changed, 79 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/test_back.c b/test/test_back.c index 9a337b9..6bf5159 100644 --- a/test/test_back.c +++ b/test/test_back.c @@ -18,6 +18,10 @@ static int nsucc = 0; static int nfail = 0; static int nerror = 0; +#ifdef __TRUSTINSOFT_ANALYZER__ +static int nall = 0; +#endif + static FILE* err_file; static OnigRegion* region; @@ -25,6 +29,10 @@ static OnigRegion* region; static void xx(char* pattern, char* str, int from, int to, int mem, int not, int error_no, int line_no) { +#ifdef __TRUSTINSOFT_ANALYZER__ + if (nall++ % TIS_TEST_CHOOSE_MAX != TIS_TEST_CHOOSE_CURRENT) return; +#endif + int r; regex_t* reg; OnigErrorInfo einfo; @@ -1419,7 +1427,7 @@ extern int main(int argc, char* argv[]) x2("\\p{Common}", "\xe3\x8b\xbf", 0, 3); /* U+32FF */ x2("\\p{In_Enclosed_CJK_Letters_and_Months}", "\xe3\x8b\xbf", 0, 3); /* U+32FF */ - e("\\x{7fffffff}", "", ONIGERR_TOO_BIG_WIDE_CHAR_VALUE); + e("\\x{7fffffff}", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("[\\x{7fffffff}]", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("\\u040", "@", ONIGERR_INVALID_CODE_POINT_VALUE); e("(?\\g)", "zzzz", ONIGERR_NEVER_ENDING_RECURSION); diff --git a/test/test_regset.c b/test/test_regset.c index c8442a1..7476ec4 100644 --- a/test/test_regset.c +++ b/test/test_regset.c @@ -50,6 +50,7 @@ make_regset(int line_no, int n, char* pat[], OnigRegSet** rset, int error_no) nfail++; } } + onig_regset_free(set); return r; } @@ -96,6 +97,7 @@ time_test(int repeat, int n, char* ps[], char* s, char* end, double* rt_set, dou ONIG_REGSET_POSITION_LEAD, ONIG_OPTION_NONE, &match_pos); if (r < 0) { fprintf(stderr, "FAIL onig_regset_search(POSITION_LEAD): %d\n", r); + onig_regset_free(set); return r; } } @@ -109,6 +111,7 @@ time_test(int repeat, int n, char* ps[], char* s, char* end, double* rt_set, dou ONIG_REGSET_REGEX_LEAD, ONIG_OPTION_NONE, &match_pos); if (r < 0) { fprintf(stderr, "FAIL onig_regset_search(REGEX_LEAD): %d\n", r); + onig_regset_free(set); return r; } } @@ -158,7 +161,10 @@ time_compare(int n, char* ps[], char* s, char* end) for (i = 0; i < n; i++) { fisher_yates_shuffle(n, ps, cps); r = time_test(repeat, n, cps, s, end, &t_set, &t_reg); - if (r != 0) return ; + if (r != 0) { + free(cps); + return ; + } total_set += t_set; total_reg += t_reg; } @@ -231,6 +237,7 @@ xx(int line_no, int n, char* ps[], char* s, int from, int to, int mem, int not, if (region == 0) { fprintf(stderr, "ERROR: %d: can't get region.\n", line_no); nerror++; + onig_regset_free(set); return ; } @@ -285,7 +292,7 @@ n(int line_no, int n, char* ps[], char* s) static int get_all_content_of_file(char* path, char** rs, char** rend) { - size_t len; + ssize_t len; size_t n; char* line; FILE* fp; diff --git a/test/test_syntax.c b/test/test_syntax.c index df80e59..06fef45 100644 --- a/test/test_syntax.c +++ b/test/test_syntax.c @@ -17,6 +17,10 @@ static int nsucc = 0; static int nfail = 0; static int nerror = 0; +#ifdef __TRUSTINSOFT_ANALYZER__ +static int nall = 0; +#endif + static FILE* err_file; static OnigRegion* region; @@ -26,6 +30,10 @@ static OnigSyntaxType* Syntax; static void xx(char* pattern, char* str, int from, int to, int mem, int not, int error_no) { +#ifdef __TRUSTINSOFT_ANALYZER__ + if (nall++ % TIS_TEST_CHOOSE_MAX != TIS_TEST_CHOOSE_CURRENT) return; +#endif + int r; regex_t* reg; OnigErrorInfo einfo; diff --git a/test/test_utf8.c b/test/test_utf8.c index 1bbc071..7a4322d 100644 --- a/test/test_utf8.c +++ b/test/test_utf8.c @@ -18,6 +18,10 @@ static int nsucc = 0; static int nfail = 0; static int nerror = 0; +#ifdef __TRUSTINSOFT_ANALYZER__ +static int nall = 0; +#endif + static FILE* err_file; static OnigRegion* region; @@ -25,6 +29,10 @@ static OnigRegion* region; static void xx(char* pattern, char* str, int from, int to, int mem, int not, int error_no) { +#ifdef __TRUSTINSOFT_ANALYZER__ + if (nall++ % TIS_TEST_CHOOSE_MAX != TIS_TEST_CHOOSE_CURRENT) return; +#endif + int r; regex_t* reg; OnigErrorInfo einfo; @@ -545,6 +553,17 @@ extern int main(int argc, char* argv[]) x2("(?<=a|bc||defghij|klmnopq|r)z", "rz", 1, 2); x3("(?<=(abc))d", "abcd", 0, 3, 1); x2("(?<=(?i:abc))d", "ABCd", 3, 4); + x2("(?<=^|b)c", " cbc", 3, 4); + x2("(?<=a|^|b)c", " cbc", 3, 4); + x2("(?<=a|(^)|b)c", " cbc", 3, 4); + x2("(?<=a|(^)|b)c", "cbc", 0, 1); + n("(Q)|(?<=a|(?(1))|b)c", "czc"); + x2("(Q)(?<=a|(?(1))|b)c", "cQc", 1, 3); + x2("(?<=a|(?~END)|b)c", "ENDc", 3, 4); + n("(?", "aa", 0, 2); x2("(?)|(?<=(\\k<1>))", ""); + x2("(a|\\k<2>)|(?<=(\\k<1>))", "a", 0, 1); + x2("(a|\\k<2>)|(?<=b(\\k<1>))", "ba", 1, 2); x2("((?(a)\\g<1>|b))", "aab", 0, 3); x2("((?(a)\\g<1>))", "aab", 0, 2); @@ -1459,6 +1488,10 @@ extern int main(int argc, char* argv[]) e("(?i)000000000000000000000\xf0", "", ONIGERR_INVALID_CODE_POINT_VALUE); /* https://bugs.php.net/bug.php?id=77382 */ n("0000\\\xf5", "0"); /* https://bugs.php.net/bug.php?id=77385 */ n("(?i)FFF00000000000000000\xfd", ""); /* https://bugs.php.net/bug.php?id=77394 */ + n("(?x)\n (?:*]|&&|\\|\\||\\?|\\*\\/|^await|[^\\._$[:alnum:]]await|^return|[^\\._$[:alnum:]]return|^default|[^\\._$[:alnum:]]default|^yield|[^\\._$[:alnum:]]yield|^)\\s*\n (?!<\\s*[_$[:alpha:]][_$[:alnum:]]*((\\s+extends\\s+[^=>])|,)) # look ahead is not type parameter of arrow\n (?=(<)\\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?))", " while (i < len && f(array[i]))"); /* Issue #192 */ + + x2("aaaaaaaaaaaaaaaaaaaaaaa恂b", "aaaaaaaaaaaaaaaaaaaaaaa恂b", 0, 27); /* Issue #221 */ + e("x{55380}{77590}", "", ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); e("(xyz){40000}{99999}(?vv)", "", ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); e("f{90000,90000}{80000,80000}", "", ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); @@ -1467,7 +1500,7 @@ extern int main(int argc, char* argv[]) x2("\\p{Common}", "\xe3\x8b\xbf", 0, 3); /* U+32FF */ x2("\\p{In_Enclosed_CJK_Letters_and_Months}", "\xe3\x8b\xbf", 0, 3); /* U+32FF */ - e("\\x{7fffffff}", "", ONIGERR_TOO_BIG_WIDE_CHAR_VALUE); + e("\\x{7fffffff}", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("[\\x{7fffffff}]", "", ONIGERR_INVALID_CODE_POINT_VALUE); e("\\u040", "@", ONIGERR_INVALID_CODE_POINT_VALUE); e("(?\\g)", "zzzz", ONIGERR_NEVER_ENDING_RECURSION); diff --git a/test/testc.c b/test/testc.c index fbede67..b3a34ea 100644 --- a/test/testc.c +++ b/test/testc.c @@ -14,11 +14,19 @@ static int nsucc = 0; static int nfail = 0; static int nerror = 0; +#ifdef __TRUSTINSOFT_ANALYZER__ +static int nall = 0; +#endif + static FILE* err_file; static OnigRegion* region; static void xx(char* pattern, char* str, int from, int to, int mem, int not) { +#ifdef __TRUSTINSOFT_ANALYZER__ + if (nall++ % TIS_TEST_CHOOSE_MAX != TIS_TEST_CHOOSE_CURRENT) return; +#endif + int r; regex_t* reg; OnigErrorInfo einfo; diff --git a/test/testu.c b/test/testu.c index 24397ab..c1971e7 100644 --- a/test/testu.c +++ b/test/testu.c @@ -14,6 +14,10 @@ static int nsucc = 0; static int nfail = 0; static int nerror = 0; +#ifdef __TRUSTINSOFT_ANALYZER__ +static int nall = 0; +#endif + static FILE* err_file; #ifndef POSIX_TEST @@ -36,7 +40,7 @@ static void uconv(char* from, char* to, int len) if (c == 0) { c = (unsigned char )from[i+1]; if (c < 0x20 || c >= 0x7f || c == 0x5c || c == 0x22) { - sprintf(q, "\\%03o", c); + sprintf(q, "\\%03o", (unsigned int )c); q += 4; } else { @@ -45,10 +49,10 @@ static void uconv(char* from, char* to, int len) } } else { - sprintf(q, "\\%03o", c); + sprintf(q, "\\%03o", (unsigned int )c); q += 4; c = (unsigned char )from[i+1]; - sprintf(q, "\\%03o", c); + sprintf(q, "\\%03o", (unsigned int )c); q += 4; } } @@ -58,6 +62,10 @@ static void uconv(char* from, char* to, int len) static void xx(char* pattern, char* str, int from, int to, int mem, int not) { +#ifdef __TRUSTINSOFT_ANALYZER__ + if (nall++ % TIS_TEST_CHOOSE_MAX != TIS_TEST_CHOOSE_CURRENT) return; +#endif + int r; char cpat[4000], cstr[4000]; -- cgit v1.2.3