-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible wrong fix to #207 #221
Comments
BTW if my analysis is wrong, then I would appreciate, if there is added test case covering this function and documentation for the |
Yes, I think you're right. |
Neither am I, but I'll try to poke some Coverity experts. |
As discussed with @voxik, this is indeed a false positive of Coverity. The checker does not track non-trivial relations of integer variables. It sees that an array bound is checked by the condition of the outer Could we suppress the false positive with the following inline annotation in the source code? --- a/src/regcomp.c
+++ b/src/regcomp.c
@@ -6260,18 +6260,19 @@ static void
concat_opt_exact_str(OptStr* to, UChar* s, UChar* end, OnigEncoding enc)
{
int i, j, len;
UChar *p;
for (i = to->len, p = s; p < end && i < OPT_EXACT_MAXLEN; ) {
len = enclen(enc, p);
if (i + len > OPT_EXACT_MAXLEN) break;
for (j = 0; j < len && p < end; j++)
+ /* coverity[overrun-local] */
to->s[i++] = *p++;
}
to->len = i;
if (p >= end)
to->reach_end = 1;
}
|
This reverts commit bf6873a. CVE-2020-26159 is bogus; the "bug" was apparently a false positive reported by Coverity, and the "fix" apparently wrong, see <kkos/oniguruma#221>.
This reverts commit bf6873a. CVE-2020-26159 is bogus; the "bug" was apparently a false positive reported by Coverity, and the "fix" apparently wrong, see <kkos/oniguruma#221>. Closes GH-6357.
This reverts commit bf6873a. CVE-2020-26159 is bogus; the "bug" was apparently a false positive reported by Coverity, and the "fix" apparently wrong, see <kkos/oniguruma#221>. Closes GH-6357. (cherry picked from commit be6d72b)
I'm still trying to wrap my head around cbe9f8b. The question is whether
s
is NULL terminated string:oniguruma/src/regcomp.c
Lines 6030 to 6036 in cbdbdad
My conclusion is that it is just array of characters, because it is accompanied by
len
field, and looking at the other places, nothing suggest it should be NULL terminated. The only place, where it could appear NULL terminated is:oniguruma/src/regcomp.c
Lines 6213 to 6221 in cbdbdad
but that is just clearing the struct.
So given the
s
is just array ofOPT_EXACT_MAXLEN
characters, lets debug throughconcat_opt_exact_str
:oniguruma/src/regcomp.c
Lines 6259 to 6276 in cbdbdad
and being on line 6267, I have following values:
That in turn means that
i + len == 0 + 1 == 1
. IfOPT_EXACT_MAXLEN
was 1, then the conditionif (i + len >= OPT_EXACT_MAXLEN) break;
would turn intoif (1 >= 1) break;
, which would break, although there is certainly one byte available in the output string.This tends me believe, that original condition, i.e.
if (i + len > OPT_EXACT_MAXLEN) break;
was the correct condition and the cbe9f8b should be reverted.This possible applies also to 8155473, but I have not checked the case.
The text was updated successfully, but these errors were encountered: