summaryrefslogtreecommitdiff
path: root/src/regexec.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2022-05-04 22:17:30 +0200
committerJörg Frings-Fürst <debian@jff.email>2022-05-04 22:17:30 +0200
commitb94fff3e1fa9f446b4d084988600836eaa686c0a (patch)
tree1ef234abd95f46744da8f6edad1ec438f5fe3ea9 /src/regexec.c
parent89374f06e12f3094feac8a6a7f95a58c348f63eb (diff)
parentbeb0a893d66abd79c495d3425746fe0e237ed848 (diff)
Merge branch 'release/debian/6.9.8-1'debian/6.9.8-1
Diffstat (limited to 'src/regexec.c')
-rw-r--r--src/regexec.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/regexec.c b/src/regexec.c
index a3cf60a..cb8e620 100644
--- a/src/regexec.c
+++ b/src/regexec.c
@@ -2,7 +2,7 @@
regexec.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2021 K.Kosako
+ * Copyright (c) 2002-2022 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -2478,7 +2478,7 @@ static int string_cmp_ic(OnigEncoding enc, int case_fold_flag,
#define ON_STR_BEGIN(s) ((s) == str)
#define ON_STR_END(s) ((s) == end)
#define DATA_ENSURE_CHECK1 (s < right_range)
-#define DATA_ENSURE_CHECK(n) (s + (n) <= right_range)
+#define DATA_ENSURE_CHECK(n) ((n) <= right_range - s)
#define DATA_ENSURE(n) if (right_range - s < (n)) goto fail
#define INIT_RIGHT_RANGE right_range = (UChar* )in_right_range
@@ -3050,6 +3050,9 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
if (n > msa->best_len) {
msa->best_len = n;
msa->best_s = (UChar* )sstart;
+ if (s >= in_right_range) {
+ best_len = msa->best_len; /* end of find */
+ }
}
else {
if (s >= in_right_range && msa->best_s == sstart) {
@@ -3858,7 +3861,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
pend = STACK_MEM_END(reg, mem);
n = (int )(pend - pstart);
if (n != 0) {
- DATA_ENSURE(n);
+ if (! DATA_ENSURE_CHECK(n)) continue;
swork = s;
STRING_CMP_VALUE(swork, pstart, n, is_fail);
if (is_fail) continue;
@@ -3887,7 +3890,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
pend = STACK_MEM_END(reg, mem);
n = (int )(pend - pstart);
if (n != 0) {
- DATA_ENSURE(n);
+ if (! DATA_ENSURE_CHECK(n)) continue;
swork = s;
STRING_CMP_VALUE_IC(case_fold_flag, pstart, &swork, n, is_fail);
if (is_fail) continue;