1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00
Commit Graph

199829 Commits

Author SHA1 Message Date
Sergei Golubchik
b2050fdb4a strengthen safe() in wsrep_sst_common, just in case mariadb-10.6.27 2026-05-23 12:31:36 +02:00
Hemant Dangi
ed8404a73f MDEV-39721: wsrep_notify.cc: reject shell-unsafe characters in joiner-supplied member fields
Issue:
wsrep_notify_status() interpolated members[i].name() (the peer's
wsrep_node_name) and members[i].incoming() verbatim into a command
string that is then executed via 'sh -c' by wsp::process. A peer
joining the cluster with shell metacharacters in its wsrep_node_name
or wsrep_node_incoming_address caused arbitrary commands to run on
every cluster member that had wsrep_notify_cmd configured.
MDEV-39413 introduced safe() for the same threat class in the SST
scripts but did not cover the C++ wsrep_notify path.

Solution:
Validate each substituted field against a narrow whitelist before
interpolating. Node name allows alnum and -_. ; node address
additionally allows :[]/ for host:port and [ipv6] forms. On bad
input the notification is skipped with an error log instead of
forwarding the unsafe value to sh -c.
2026-05-22 20:13:20 +02:00
Sergei Golubchik
a9e2f7f648 MDEV-39676 disallow global.wsrep_sst_donor=NULL again
it crashes in galera.mdev-28433
2026-05-21 11:19:44 +02:00
Hemant Dangi
dae315a7b2 MDEV-39648: wsrep_sst_rsync.sh: apply safe() to joiner-supplied parameters
Issue:
wsrep_sst_rsync.sh interpolated WSREP_SST_OPT_REMOTE_USER and
WSREP_SST_OPT_REMOTE_PSWD verbatim. Because both values originate from
the joiner side of the SST request, a newline in either could splice
an extra directive into the donor-written stunnel.conf (silently
downgrading peer-cert verification) or an extra line into the rsync
magic file. MDEV-39413 had introduced safe() for the same threat class
in wsrep_sst_mariabackup but did not extend it to the rsync script.

Solution:
Routing the rsync interpolations through safe() closes the gap, and
extending safe() to also reject tab and newline ensures multi-line
values cannot survive into a config-file heredoc.
2026-05-20 22:49:21 +02:00
Sergei Golubchik
5cedbdfcc6 fix columnstore for new cmake 2026-05-20 22:49:21 +02:00
Sergei Golubchik
fe3039eef7 MDEV-39673 group_concat ignores max_allowed_packet
GROUP_CONCAT is limited by group_concat_max_len,
but also, as a string function it must respect max_allowed_packet.

Let's introduce THD::gconcat_max_len() helper to simplify checks.

Also:
* make max group_concat_max_len value the same as max max_allowed_packet
* use the same MY_MIN((ulonglong) ..., UINT_MAX32) in
  Item_func_json_objectagg as in Item_func_group_concat
* use overflow-safe type for lengths in Item_func_quote
  (MAX_MAX_ALLOWED_PACKET is 1G so uint cannot overflow yet, but it's
  a fragile assumption)
2026-05-20 22:49:21 +02:00
Sergei Golubchik
52bbe5b6e7 MDEV-39658 ASAN crash on invalid proxy_protocol_networks value
max_subnet estimate was off by one.

* only allow address with a known family
  (trips an assert in addr_matches_subnet())
* adjust max_subnet estimate accordinly
2026-05-20 22:49:20 +02:00
Sergei Golubchik
32ab8a2d4c MDEV-39657 ASAN error on malformed WKB point
check data length for Gis_point
2026-05-20 22:49:20 +02:00
Sergei Golubchik
11c41cd93d MDEV-39622 OBJECT_INSTANCE_BEGIN in P_S are unstable, difficult to compare
let's show stable values that don't change between runs
2026-05-20 22:49:20 +02:00
Sergei Golubchik
9a3e153188 MDEV-39581 dynamic column header missing sanity checks 2026-05-20 22:49:20 +02:00
Sergei Golubchik
05663d1910 MDEV-39576 PROXY v2 protocol uninitialized memory reads 2026-05-20 22:49:20 +02:00
Sergei Golubchik
31319c7bc6 proxy protocol v2: fix a harmless typo
according to the rfc, the length is 2 bytes,
but the max length is 226 and there's a validity
check for length <= 240.
2026-05-20 22:49:20 +02:00
Sergei Golubchik
c5409caab0 MDEV-39564 One-byte OOB write in PROXY protocol v1 header parser 2026-05-20 22:49:20 +02:00
Sergei Golubchik
1648170c5c MDEV-39565 missing filename check in mariadb-backup --decompress
check for tablename-safe characters in backed up table files
2026-05-20 22:49:20 +02:00
Jan Lindström
3a3c1e403b Prepare for Galera library version 26.4.27 2026-05-20 22:47:51 +02:00
Jan Lindström
03e040ea90 Fix test failure on galera_sst_mariabackup_encrypt_with_key_server
Joiner mariadbd exits when SST is aborted; the exit code varies by
platform (clean 0 on some systems, signalled 134 / 1 on others).

pkill exit code can also vary by platform (clean 0 on some systems,
signalled 1 others).
2026-05-20 22:47:51 +02:00
Jan Lindström
13e6808f01 MDEV-39676 : Galera Cluster-peer > Donor command execution
Add verification of wsrep_sst_donor, wsrep_sst_method and
wsrep_sst_receive_address so that they contain only
supported characters. But allow NULL or empty value.
2026-05-20 22:47:51 +02:00
Marko Mäkelä
61d251c656 MDEV-13542 fixup: Remove orphan trx_print() 2026-05-19 08:27:29 +03:00
Daniel Bartholomew
f0ae019e1a bump the VERSION 2026-05-18 12:22:33 -04:00
Monty
da58c0c137 Ensure that mtr.out-of-source is not acccidently calling itself
Calling itself will cause extensive memory usage that can kill
the machine when it runs out of memory (happend to me).

Fixed by having mtr.out-of-source checking that it is not calling itself.
In addition added a check for cmake to expand symlinks to make the
check if we are running mtr 'out of source' safer.

Author: Sergei Golubchik <serg@mariadb.org> (CMakeList.txt changes)
2026-05-15 15:11:08 +03:00
Oleksandr Byelkin
d37e50c6d0 fix long name on view protocol mariadb-10.6.26 2026-05-08 07:24:06 +02:00
Rucha Deodhar
902d05a22a MDEV-39213: json range syntax crash
Analysis:
When json is being parsed, the step decreases without a out-of-bound check
resulting in failure.
Fix:
Before decreasing the step, check if it will result into out of bound.
2026-05-07 14:39:35 -04:00
Sergei Golubchik
200eb5365a MDEV-39516 s3 curl_easy_setopt requires long values otherwise compile failure
update submodule to compile on fc44
2026-05-06 16:03:39 +02:00
Sergei Golubchik
32327e572b MDEV-39540 crash due to narrowing cast in update_ref_and_keys() 2026-05-06 13:28:33 +02:00
Sergei Golubchik
d0501281ec MDEV-39481 ASAN error on malformed WKB polygon
let's make is difficult for wkb and len to desync
2026-05-06 13:28:23 +02:00
Oleksandr Byelkin
bedacb3eeb new CC 3.3 2026-05-05 20:34:36 +02:00
Varun Deep Saini
551c980587 MDEV-35548: Fix out-of-bounds array access in json_get_path_start
json_get_path_start() set p->last_step to p->steps - 1, creating a
pointer before the beginning of the steps[] array. This is undefined
behavior flagged by UBSAN as "index -1 out of bounds for type
json_path_step_t[32]".

Use NULL as the sentinel value instead, and check for NULL in
json_get_path_next() rather than comparing against p->steps.

Backport to 10.6 of commit 4f546897b8.

Additional test case from Rucha Deodhar

Signed-off-by: Varun Deep Saini <varun.23bcs10048@ms.sst.scaler.com>
Signed-off-by: Varun Deep Saini <deepsainivarun@gmail.com>
2026-05-05 15:48:12 +02:00
Sergei Golubchik
05f36e67d3 MDEV-39266 Stack Overflow via alloca() in Privilege Table JSON Parser 2026-04-30 12:10:09 +02:00
Sergei Golubchik
557bd9ef90 MDEV-39498 more fixes
* use max_length=640
* also fix mroonga_highlight_html, mroonga_normalize, mroonga_snippet_html
* remove disable_cursor_protocol from all mroonga tests
2026-04-30 00:08:58 +02:00
Sergei Golubchik
673cc11797 MDEV-39498 mroonga_command() incorrect result length metadata 2026-04-29 17:03:54 +02:00
Sergei Golubchik
c0fb844833 MDEV-39493 FILE privilege isn't checked for derived
check global privileges separately,
before checking for per-table SELECT_ACL
2026-04-29 15:38:03 +02:00
Sergei Golubchik
7984408bbd MDEV-39481 ASAN error on malformed WKB polygon 2026-04-29 15:38:03 +02:00
Sergei Golubchik
92641e4aa8 MDEV-39478 COM_STMT_EXECUTE incorrectly checks for parameter value length
* remove redundant checks for `len` in `get_param_length()`
* validate return value `length` in `get_param_length()`
* fix all `Item_param::set_param_XXX()` methods to never read past `len`

note that all `Item_param::set_param_XXX()` methods correctly handle
zero-length values.
2026-04-29 15:38:03 +02:00
Sergei Golubchik
ce44ae3ec6 MDEV-39292 set architecture before it's used
followup for 29453945ba
2026-04-29 14:51:57 +02:00
Oleksandr Byelkin
4fad03c70a new CC 3.3 2026-04-29 10:16:24 +02:00
Aquila Macedo
dc4b5d480f MDEV-39479 Mroonga: avoid hang on invalid index flags
Stop parsing index flags after reporting an invalid flag in
mrn_parse_grn_index_column_flags().

Otherwise, an invalid index comment such as flags "COMPRESS_ZSTD" can
make CREATE TABLE loop forever while emitting warnings. Add a regression
test for this case and check that the invalid flag is reported once and
the default index flags are used.
2026-04-29 10:07:03 +02:00
Alexey Botchkov
de14631413 MDEV-15479 Empty string is erroneously allowed as a GEOMETRY column value.
Empty string disallowed.
2026-04-28 00:41:52 +04:00
Thirunarayanan Balathandayuthapani
9f6152b141 MDEV-39261 MariaDB crash on startup in presence of indexed virtual columns
Problem:
========
Purge threads computing virtual columns could crash due to:
1. Stale TABLE* pointers when tables are flushed/rebuilt during purge
2. open_purge_table() called close_thread_tables() on failure, making
MDL tickets invalid before purge could release them
3. Purge coordinator opened TABLE* but workers accessed it with wrong
TABLE->in_use
4. No retry mechanism when open_purge_table() failed due to concurrent
FLUSH TABLES, BACKUP STAGE, or ALTER TABLE operations

Solution:
========
1. Removed close_thread_tables() from open_purge_table(). Purge
coordinator thread should close explicitly in close_and_reopen()

2. Added retry logic: when open_purge_table() returns NULL due to
table flush/rebuild, set must_wait() flag and retry in
close_and_reopen()

3. Update close_and_reopen() with purge_table parameter to
close the failed table. Pass it to trx_purge_close_tables()
for proper cleanup

4. Properly set and reset TABLE::in_use during purge operations:
- Set to coordinator_thd in row_purge_parse_undo_rec() when opening
- Reset in trx_purge_close_table() when closing

5. The auto_increment initialization now happens unconditionally for
purge threads , ensuring the auto_increment counter is always
properly initialized when purge opens tables with virtual columns
2026-04-27 15:32:11 +05:30
Thirunarayanan Balathandayuthapani
8c930cdc5a MDEV-39261 MariaDB crash on startup in presence of indexed virtual columns
Problem:
========
A single InnoDB purge worker thread can process undo logs from different
tables within the same batch. But get_purge_table(), open_purge_table()
incorrectly assumes that a 1:1 relationship between a purge worker thread
and a table within a single batch. Based on this wrong assumtion,
InnoDB attempts to reuse TABLE objects cached in thd->open_tables for
virtual column computation.

1) Purge worker opens Table A and caches the TABLE pointer in thd->open_tables.
2) Same purge worker moves to Table B in the same batch, get_purge_table()
retrieves the cached pointer for Table A instead of opening Table B.
3) Because innobase::open() is ignored for Table B, the virtual column
template is never initialized.
4) virtual column computation for Table B aborts the server

Solution:
========
- Introduced purge_table class which has the following
purge_table: Stores either TABLE* (for tables with indexed virtual
columns) or MDL_ticket* (for tables without) in a single union
using LSB as a flag.
For tables with indexed virtual columns: opens TABLE*, accesses
MDL_ticket* via TABLE->mdl_ticket
For tables without indexed virtual columns: stores only MDL_ticket*.

trx_purge_attach_undo_recs(): Coordinator opens both dict_table_t*
and TABLE* with proper MDL protection. Workers access cached
table pointers from purge_node_t->tables without opening
their own handles

purge_sys.coordinator_thd: Distinguish coordinator from workers
in cleanup logic. Skip innobase_reset_background_thd() for
coordinator thread to prevent premature table closure during
batch processing. Workers still call cleanup to release their
thread-local resources

trx_purge_close_tables():
Rewrite for purge coordinator thread
1) Close all dict_table_t* objects first
2) Call close_thread_tables() once for all TABLE* objects
3) Release MDL tickets last, after tables are closed

Added table->lock_mutex protection when reading (or) writing
vc_templ->mysql_table and mysql_table_query_id. Clear cached
TABLE* pointers before closing tables to prevent stale pointer
access

Declared open_purge_table() and close_thread_tables() in trx0purge.cc
Declared reset_thd() in row0purge.cc and dict0stats_bg.cc.
Removed innobase_reset_background_thd()
2026-04-27 15:32:11 +05:30
Raghunandan Bhat
a73d1f3b1e MDEV-39265: Assertion (mem_root->flags & 4) == 0 failed upon 2nd execution USING DEFAULT with sequence
Problem:
  When a prepared statement uses `DEFAULT` with sequence, on its
  second or subsequent execution, server tries to allocate TABLE_LIST
  object (used for adding sequence table to `internal_tables` list) on
  statement's memory root. This fails with an assert because statement's
  memory root is marked read-only after the first execution.

  CREATE SEQUENCE s;
  CREATE TABLE t (a INT DEFAULT(NEXTVAL(s)));
  PREPARE stmt FROM "UPDATE t SET a = ?";

  EXECUTE stmt USING 3; -- first execution, marks mem_root read-only
  EXECUTE stmt USING DEFAULT;  -- tries to allocate on second execution

Fix:
  Temporarily clear the read-only flag on the statement memory root to
  allow the allocation. Also adds a debug hook to verify allocation
  happens not more than once per prepared statement and per internal
  table added to the list.
2026-04-27 11:40:10 +02:00
Oleksandr Byelkin
a6575e2a1d new wolfssl v5.9.1-stable 2026-04-27 10:00:54 +02:00
Oleksandr Byelkin
94bfbfeeb9 new CC 3.3 2026-04-27 10:00:54 +02:00
Sergei Golubchik
3730b92be0 zlib 1.3.2 2026-04-24 22:19:40 +02:00
Sergei Golubchik
3e3c5d72c8 MDEV-39413 wsrep unsafe handling of parameters
introduce safe() wrapper for parameters that can later be interpolated
into command line.
Use as

- var="foo$BAR"
+ var="foo$(safe BAR)"

A parameter is safe, if it contains no spaces, single quotes or backticks
2026-04-24 12:36:24 +02:00
Sergei Golubchik
12bb87f4a9 cleanup: remove galera test certificates from mtr
use server certs instead. galera CA didn't have a key saved in std_data,
so they could not be regenerated when needed.
2026-04-23 15:53:26 +02:00
Sergei Golubchik
2bbfcb1876 MDEV-39408 mbstream insufficient path validation
reject paths that could not have been written by mariadb-backup
2026-04-23 15:53:26 +02:00
Sergei Golubchik
d56b6b6ea1 MDEV-39404 Gtid_log_event crash
validate xid.gtrid_length and xid.bqual_length just like XID_EVENT does
2026-04-23 15:53:26 +02:00
Alexey Botchkov
855ee88362 MDEV-39210 ExtractValue/UpdateXML crash.
test and a comment fixed.
2026-04-22 21:05:46 +04:00
Oleksandr Byelkin
8f308454b6 MDEV-39389 Memory leaks in _db_set_init
Handle forgotten case of resetting parameters
(free command_line before assigning a new one).
2026-04-22 13:27:23 +02:00
Oleksandr Byelkin
ceabbd5492 zlib 1.3.2 2026-04-22 13:12:54 +02:00