aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorK.Kosako <kkosako0@gmail.com>2024-06-24 00:01:41 +0900
committerK.Kosako <kkosako0@gmail.com>2024-06-24 00:01:41 +0900
commit25cf18bf40e7983be287174e109a1bc96c7a1029 (patch)
treeb946b178a65ce076cc86e4d93c8c1b3c0b00b1c3
parentbcfbab2e38956c67029a4743a97644f119dc4be3 (diff)
downloadoniguruma-master.zip
oniguruma-master.tar.gz
oniguruma-master.tar.bz2
add retry limit counter overflow check in DEBUG modeHEADmaster
-rw-r--r--src/regexec.c7
-rw-r--r--src/regint.h6
2 files changed, 12 insertions, 1 deletions
diff --git a/src/regexec.c b/src/regexec.c
index 35a94ad..ddec265 100644
--- a/src/regexec.c
+++ b/src/regexec.c
@@ -4478,6 +4478,13 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
match_at_end:
if (msa->retry_limit_in_search != 0) {
+#ifdef ONIG_DEBUG
+ if (retry_in_match_counter >
+ ULONG_MAX - msa->retry_limit_in_search_counter) {
+ fprintf(DBGFP, "retry limit counter overflow: %8lu/%8lu\n",
+ retry_in_match_counter, msa->retry_limit_in_search_counter);
+ }
+#endif
msa->retry_limit_in_search_counter += retry_in_match_counter;
}
diff --git a/src/regint.h b/src/regint.h
index b7a89a6..834a81c 100644
--- a/src/regint.h
+++ b/src/regint.h
@@ -37,6 +37,7 @@
/* #define ONIG_DEBUG_MATCH_COUNTER */
/* #define ONIG_DEBUG_CALL */
/* #define ONIG_DONT_OPTIMIZE */
+/* #define ONIG_DEBUG */
/* for byte-code statistical data. */
/* #define ONIG_DEBUG_STATISTICS */
@@ -47,10 +48,13 @@
defined(ONIG_DEBUG_STATISTICS)
#ifndef ONIG_DEBUG
#define ONIG_DEBUG
-#define DBGFP stderr
#endif
#endif
+#ifdef ONIG_DEBUG
+#define DBGFP stderr
+#endif
+
#ifndef ONIG_DISABLE_DIRECT_THREADING
#ifdef __GNUC__
#define USE_GOTO_LABELS_AS_VALUES