summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYogita Urade <yogita.urade@windriver.com>2025-06-25 13:03:11 +0530
committerArmin Kuster <akuster808@gmail.com>2025-07-02 20:38:46 -0400
commitc2140f3f2a82a7f095762d7fe7fd1f0bfa1c8d8e (patch)
tree3daa323d9730854db47f0d9a22f8519788aa07d7
parent72f2dd38ca1bfae31190d3791adc2a9cac4da111 (diff)
downloadmeta-openembedded-c2140f3f2a82a7f095762d7fe7fd1f0bfa1c8d8e.tar.gz
mariadb: fix CVE-2023-52968
MariaDB Server 10.4 before 10.4.33, 10.5 before 10.5.24, 10.6 before 10.6.17, 10.7 through 10.11 before 10.11.7, 11.0 before 11.0.5, and 11.1 before 11.1.4 calls fix_fields_if_needed under mysql_derived_prepare when derived is not yet prepared, leading to a find_field_in_table crash. Reference: https://nvd.nist.gov/vuln/detail/CVE-2023-52968 Upstream patch: https://github.com/MariaDB/server/commit/74883f5e2f4c0e09f4f4e9e272a8e5bfd91a9489 Fix indent issue in mariadb.inc file. Signed-off-by: Yogita Urade <yogita.urade@windriver.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta-oe/recipes-dbs/mysql/mariadb.inc3
-rw-r--r--meta-oe/recipes-dbs/mysql/mariadb/CVE-2023-52968.patch106
2 files changed, 108 insertions, 1 deletions
diff --git a/meta-oe/recipes-dbs/mysql/mariadb.inc b/meta-oe/recipes-dbs/mysql/mariadb.inc
index 7c4b0a467f..6a8ff05039 100644
--- a/meta-oe/recipes-dbs/mysql/mariadb.inc
+++ b/meta-oe/recipes-dbs/mysql/mariadb.inc
@@ -22,7 +22,8 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
22 file://cross-compiling.patch \ 22 file://cross-compiling.patch \
23 file://0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch \ 23 file://0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch \
24 file://0001-MDEV-29644-a-potential-bug-of-null-pointer-dereferen.patch \ 24 file://0001-MDEV-29644-a-potential-bug-of-null-pointer-dereferen.patch \
25 file://CVE-2023-22084.patch \ 25 file://CVE-2023-22084.patch \
26 file://CVE-2023-52968.patch \
26 " 27 "
27SRC_URI:append:libc-musl = " file://ppc-remove-glibc-dep.patch" 28SRC_URI:append:libc-musl = " file://ppc-remove-glibc-dep.patch"
28 29
diff --git a/meta-oe/recipes-dbs/mysql/mariadb/CVE-2023-52968.patch b/meta-oe/recipes-dbs/mysql/mariadb/CVE-2023-52968.patch
new file mode 100644
index 0000000000..bea473e4a3
--- /dev/null
+++ b/meta-oe/recipes-dbs/mysql/mariadb/CVE-2023-52968.patch
@@ -0,0 +1,106 @@
1From 74883f5e2f4c0e09f4f4e9e272a8e5bfd91a9489 Mon Sep 17 00:00:00 2001
2From: Aleksey Midenkov <midenok@gmail.com>
3Date: Thu, 9 Nov 2023 16:26:11 +0300
4Subject: [PATCH] MDEV-32082 Server crash in find_field_in_table
5
6Attempt to resolve FOR SYSTEM_TIME expression as field for derived
7table is done before derived table is fully prepared, so we fail on
8assertion that table_list->table is missing.
9
10Actually Vers_history_point::resolve_unit() is done under the call of
11mysql_derived_prepare() itself (sql_derived.cc:824) and the table is
12assigned later at 867.
13
14The fix disables unit resolution for field type in FOR SYSTEM_TIME
15expression as it does a little sense in any case: making historical
16queries based on variable field values produces the result of multiple
17time points.
18
19fix_fields_if_needed() in resolve_units() was introduced by 46be31982a4
20
21CVE: CVE-2023-52968
22Upstream-Status: Backport [https://github.com/MariaDB/server/commit/74883f5e2f4c0e09f4f4e9e272a8e5bfd91a9489]
23
24Changes:
25-Use old my_error API instead of new bad_expression_data_type_error API.
26
27Signed-off-by: Yogita Urade <yogita.urade@windriver.com>
28---
29 mysql-test/suite/versioning/r/select.result | 11 ++++++++++-
30 mysql-test/suite/versioning/t/select.test | 12 +++++++++++-
31 sql/table.cc | 6 ++++++
32 3 files changed, 27 insertions(+), 2 deletions(-)
33
34diff --git a/mysql-test/suite/versioning/r/select.result b/mysql-test/suite/versioning/r/select.result
35index 90c99d1b..714455b6 100644
36--- a/mysql-test/suite/versioning/r/select.result
37+++ b/mysql-test/suite/versioning/r/select.result
38@@ -443,7 +443,7 @@ create or replace table t1 (x int) with system versioning;
39 select * from t1 for system_time as of current_timestamp;
40 x
41 select * from t1 for system_time as of now;
42-ERROR 42S22: Unknown column 'now' in 'FOR SYSTEM_TIME'
43+ERROR HY000: Illegal parameter data type now for operation 'FOR SYSTEM_TIME'
44 ### Issue #405, NATURAL JOIN failure
45 create or replace table t1 (a int) with system versioning;
46 create or replace table t2 (b int);
47@@ -708,3 +708,12 @@ No A B C D
48 33 1 1 1 1
49 34 1 1 1 1
50 SET GLOBAL innodb_stats_persistent = @saved_stats_persistent;
51+#
52+# MDEV-32082 Server crash in find_field_in_table
53+#
54+create table t0 (c0 int) with system versioning;
55+select x0 from (
56+select c0 x0 from t0
57+) for system_time as of nowasdf deriv;
58+ERROR HY000: Illegal parameter data type nowasdf for operation 'FOR SYSTEM_TIME'
59+drop table t0;
60diff --git a/mysql-test/suite/versioning/t/select.test b/mysql-test/suite/versioning/t/select.test
61index 9142a8fa..5603d1a3 100644
62--- a/mysql-test/suite/versioning/t/select.test
63+++ b/mysql-test/suite/versioning/t/select.test
64@@ -314,7 +314,7 @@ select * from t1 where (a, 2) in ((1, 1), (2, 2)) and b = 1;
65 --echo ### Issue #398, NOW is now non-magic
66 create or replace table t1 (x int) with system versioning;
67 select * from t1 for system_time as of current_timestamp;
68---error ER_BAD_FIELD_ERROR
69+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
70 select * from t1 for system_time as of now;
71
72 --echo ### Issue #405, NATURAL JOIN failure
73@@ -487,4 +487,14 @@ call verify_trt_dummy(34);
74
75 SET GLOBAL innodb_stats_persistent = @saved_stats_persistent;
76
77+--echo #
78+--echo # MDEV-32082 Server crash in find_field_in_table
79+--echo #
80+create table t0 (c0 int) with system versioning;
81+--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
82+select x0 from (
83+ select c0 x0 from t0
84+) for system_time as of nowasdf deriv;
85+drop table t0;
86+
87 -- source suite/versioning/common_finish.inc
88diff --git a/sql/table.cc b/sql/table.cc
89index e0e06702..81a5674a 100644
90--- a/sql/table.cc
91+++ b/sql/table.cc
92@@ -10326,6 +10326,12 @@ bool Vers_history_point::check_unit(THD *thd)
93 {
94 if (!item)
95 return false;
96+ if (item->real_type() == Item::FIELD_ITEM)
97+ {
98+ my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
99+ item->full_name(), "FOR SYSTEM_TIME");
100+ return true;
101+ }
102 if (item->fix_fields_if_needed(thd, &item))
103 return true;
104 const Type_handler *t= item->this_item()->real_type_handler();
105--
1062.40.0