Fix CVE-2019-16163

Resolves: RHEL-9506
This commit is contained in:
Vitezslav Crhonek 2023-12-21 10:39:10 +01:00
parent 0bd48a7bf0
commit e95feeef8b
2 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,42 @@
diff -up onig-6.8.2/src/regparse.c.orig onig-6.8.2/src/regparse.c
--- onig-6.8.2/src/regparse.c.orig 2023-11-22 10:28:14.536985966 +0100
+++ onig-6.8.2/src/regparse.c 2023-11-22 10:32:19.677112046 +0100
@@ -6198,6 +6198,7 @@ parse_char_class(Node** np, OnigToken* t
env->parse_depth++;
if (env->parse_depth > ParseDepthLimit)
return ONIGERR_PARSE_DEPTH_LIMIT_OVER;
+
prev_cc = (CClassNode* )NULL;
r = fetch_token_in_cc(tok, src, end, env);
if (r == TK_CHAR && tok->u.c == '^' && tok->escaped == 0) {
@@ -7723,14 +7724,18 @@ static int
parse_exp(Node** np, OnigToken* tok, int term, UChar** src, UChar* end,
ScanEnv* env)
{
- int r, len, group = 0;
+ int r, len, group;
Node* qn;
Node** targetp;
+ unsigned int parse_depth;
+ group = 0;
*np = NULL;
if (tok->type == (enum TokenSyms )term)
goto end_of_token;
+ parse_depth = env->parse_depth;
+
switch (tok->type) {
case TK_ALT:
case TK_EOT:
@@ -8037,6 +8042,10 @@ parse_exp(Node** np, OnigToken* tok, int
if (is_invalid_quantifier_target(*targetp))
return ONIGERR_TARGET_OF_REPEAT_OPERATOR_INVALID;
+ parse_depth++;
+ if (parse_depth > ParseDepthLimit)
+ return ONIGERR_PARSE_DEPTH_LIMIT_OVER;
+
qn = node_new_quantifier(tok->u.repeat.lower, tok->u.repeat.upper,
(r == TK_INTERVAL ? 1 : 0));
CHECK_NULL_RETURN_MEMERR(qn);

View File

@ -11,6 +11,7 @@ Source0: https://github.com/kkos/oniguruma/releases/download/v%{version}/onig-%{
# (upstream: https://github.com/kkos/oniguruma/commit/c509265c5f6ae7264f7b8a8aae1cfa5fc59d108c)
Patch100: oniguruma-6.8.2-CVE-2019-13225-fix.patch
Patch101: oniguruma-6.8.2-CVE-2019-13224-fix.patch
Patch102: oniguruma-6.8.2-CVE-2019-16163-fix.patch
%description
Oniguruma is a regular expressions library.
@ -48,6 +49,7 @@ done
%patch100 -p1 -b .CVE-2019-13225
%patch101 -p1 -b .CVE-2019-13224
%patch102 -p1 -b .CVE-2019-16163
%build
%configure \
@ -107,6 +109,8 @@ find $RPM_BUILD_ROOT -name '*.la' \
* Thu Dec 21 2023 Vitezslav Crhonek <vcrhonek@redhat.com> - 6.8.2-3
- Fix CVE-2019-13224
Resolves: RHEL-6970
- Fix CVE-2019-16163
Resolves: RHEL-9506
* Fri Jun 26 2020 Jiri Kucera <jkucera@redhat.com> - 6.8.2-2
- Fix CVE-2019-13225