Commit Graph

1765 Commits

Author SHA1 Message Date
a8d4642375 Merge branch '10.11' into 11.4 2025-04-26 10:53:02 +02:00
20b818f45e Merge branch '10.6' into 10.11 2025-04-21 11:23:11 +02:00
a135551569 Merge branch '10.5' into 10.6 2025-04-21 10:43:17 +02:00
fbec528cbb MDEV-36245 review changes
Closes #3874
2025-04-19 10:16:19 +02:00
8c6b0d092a MDEV-36245 Long server_audit_file_path causes buffer overflow
Limit size of server_audit_file_path value

Currently, the length of this value is not checked and can cause a buffer
overflow if given a long file path specifying a directory.

In file_logger:logger_open(), there is a check:
```
  if (new_log.path_len+n_dig(rotations)+1 > FN_REFLEN)
    // handle error
```

As n_dig(rotations) may return up to 3, this inherently limits the file path to
FN_REFLEN - 4 characters.

All new code of the whole pull request, including one or several files that are
either new files or modified ones, are contributed under the BSD-new license. I
am contributing on behalf of my employer Amazon Web Services, Inc.
2025-04-19 09:59:29 +02:00
15fd232da4 MDEV-36235 Incorrect result for BETWEEN over unique blob prefix
Disallow range optimization for BETWEEN when casting one of the arguments
from STRING to a numeric type would be required to construct a range for
the query.

Adds a new method on Item_func_between called can_optimize_range_const
which allows range optimization when the types of the arguments to BETWEEN
would permit it.
2025-04-18 12:44:17 -04:00
1a013cea95 Merge branch '10.6' into '10.11' 2025-04-16 03:34:40 +02:00
88dfa6bcee Merge branch '10.5' into '10.6' 2025-04-15 01:49:48 +02:00
ba34657cd2 MDEV-35238 (MDEV-34922) Wrong results from a tables with a single record and an aggregate
The problem is that copy function was used in field list but never
copied in this execution path.

So copy should be performed before returning result.

Protection against uninitialized copy usage added.
2025-04-14 10:47:27 +02:00
60638a84e8 MDEV-36586 USER_STATISTICS.BUSY_TIME is in microseconds
the bug was that MDEV-35720 missed two lines

followup for 95975b921e
2025-04-13 12:19:56 +02:00
93ea4f29a4 MDEV-36347 UBSAN: plugins.auth_v0100 - runtime error: call to function do_auth_0x0100
through pointer to incorrect function type.

Redoing a new plugin interface for an obsolete protocol was
too much so we just remove the UBSAN testing on the function.

It wasn't possible to just disable funtion-type-mismatch
2025-04-07 11:04:53 +02:00
f5bd250f5b Merge 10.11 into 11.4 2025-03-28 13:55:21 +02:00
ab0f2a00b6 Merge 10.6 into 10.11 2025-03-27 08:01:47 +02:00
e3d7d5ca26 Merge branch '10.5' into '10.6' 2025-02-27 04:02:33 +01:00
583b39811c MDEV-35620 UBSAN: runtime error: applying zero offset to null pointer
in _ma_unique_hash, skip_trailing_space, my_hash_sort_mb_nopad_bin and my_strnncollsp_utf8mb4_bin

UBSAN detected the nullptr-with-offset in a few places
when handling empty blobs.

Fix:
- Adding DBUG_ASSERT(source_string) into all hash_sort() implementations
  to catch this problem in non-UBSAN debug builds.
- Fixing mi_unique_hash(), mi_unique_comp(),
  _ma_unique_hash(), _ma_unique_comp() to replace NULL pointer to
  an empty string ponter..

Note, we should also add DBUG_ASSERT(source_string != NULL) into
all implementations of strnncoll*(). But I'm afraid the patch
is going to be too long and too dangerous for 10.5.
2025-02-03 16:45:02 +04:00
7d657fda64 Merge branch '10.11 into 11.4 2025-01-30 12:01:11 +01:00
e69f8cae1a Merge branch '10.6' into 10.11 2025-01-30 11:55:13 +01:00
98dbe3bfaf Merge 10.5 into 10.6 2025-01-20 09:57:37 +02:00
e551070ba4 MDEV-35468 UUID primary key filtering return incorrect results
UUID::cmp() correctly compared:
- two swapped v1 UUIDs
- two non-swapped v6 UIDs

but v1 vs v6 were not compared correctly.

Adding a new method cmp_swap_noswap() and using
it in UUID::cmp() to compare two value of different swapness.
2025-01-17 11:09:12 +04:00
3158af03bd A cleanup for MDEV-35427: recording new type_uuid_ps.result
Forgot to "git add" it in the previous commit.
2025-01-16 21:52:55 +04:00
c8ef86cc8b A cleanup for MDEV-35427 to avoid dependency from the current date
Adding a "SET timestamp" command before the test body.
2025-01-16 21:04:39 +04:00
86b257f870 MDEV-35632 HandlerSocket uses deprecated C++98 auto_ptr
Change uses of auto_ptr to unique_ptr
2025-01-16 11:43:27 -05:00
f4e999d753 MDEV-35427 Assertion `is_null() >= item->null_value' failed in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null on EXECUTE
This problem was earlier fixed by MDEV-25593.
Adding a test case only.
2025-01-15 13:18:12 +04:00
f1a7693bc0 Merge branch '10.11' into 11.4 2025-01-14 23:45:41 +01:00
221aa5e08f Merge branch '10.6' into 10.11 2025-01-10 13:14:42 +01:00
9b941dc51f MDEV-34494 restore broken feedback plugin
it must report feedback_server_uid otherwise report stats won't work.
2025-01-09 10:00:36 +01:00
17f01186f5 Merge 10.11 into 11.4 2025-01-09 07:58:08 +02:00
420d9eb27f Merge 10.6 into 10.11 2025-01-08 12:51:26 +02:00
b251cb6a4f Merge 10.5 into 10.6 2025-01-08 08:48:21 +02:00
4e9c7031a5 MDEV-35575 Fix memory leak, when installing auth_gssapi plugin fails.
Make sure to release memory, which was allocated by gss_import_name().
Also when plugin_init() fails.
2025-01-07 15:49:20 +01:00
a54d151fc1 Merge 10.6 into 10.11 2024-12-19 15:38:53 +02:00
155203c352 Merge branch '10.5' into '10.6' 2024-12-13 01:45:35 +01:00
9a25f2a5bb MDEV-35632: HandlerSocket uses deprecated auto_ptr
Let us suppress the deprecation warnings more specifically.

This fixes up commit d76f5774fe
2024-12-12 11:58:11 +02:00
69e20cab28 Merge 10.5 into 10.6 2024-12-11 14:46:43 +02:00
bf7cfa2535 MDEV-35574 remove obsolete pthread_exit calls
Threads can normally exit without a explicit pthread_exit call.

There seem to date to old glibc bugs, many around 2.2.5.

The semi related bug was https://bugs.mysql.com/bug.php?id=82886.

To improve safety in the signal handlers DBUG_* code was removed.

These where also needed to avoid some MSAN unresolved stack issues.

This is effectively a backport of 2719cc4925.
2024-12-10 12:12:20 +11:00
694d91da89 MDEV-35604: SIGSEGV in filter_query_type | log_statement_ex / auditing
Take into account that filter_query_type can get empty query after
skip_set_statement run on incorrect query.
2024-12-09 09:42:26 +01:00
0f47db8525 Merge 10.11 -> 11.4
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2024-12-05 11:01:42 +01:00
e7c6cdd842 Merge 10.6 -> 10.11
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2024-12-05 10:11:58 +01:00
cefdc3e67d Merge branch '10.5' into '10.6' 2024-12-03 13:08:12 +01:00
5c86f3df33 MDEV-35522: MariaDB Audit does not detect all DCLs forms when masking password
1. skip OR REPLACE
 (to make it filter_query_type made recursive)

2. skip SET STATEMENT ... FOR before checking
statements with passwords
2024-12-02 15:44:12 +01:00
3de412fbe8 MDEV-25593 Assertion `0' failed in Type_handler_temporal_result::Item_get_date on double EXECUTE
When binding to NULL, DEFAULT or IGNORE from an Item value, Item_param did not
change m_type_handler, so its value remained from the previous bind.
Thid led to DBUG_ASSERTs in Item_param::get_date() and
Timestamp_or_zero_datetime_native_null.

Fix:

Set Item_param::m_type_handler to &type_handler_null when
binding from an Item returning NULL.

This patch also fixes MDEV-35427.
2024-12-02 11:19:12 +01:00
2719cc4925 Merge 10.11 into 11.4 2024-12-02 11:35:34 +02:00
3d23adb766 Merge 10.6 into 10.11 2024-11-29 13:43:17 +02:00
7d4077cc11 Merge 10.5 into 10.6 2024-11-29 12:37:46 +02:00
0ea19c12fd MDEV-35507 ed25519 authentication plugin create user statement trigger plain text password in audit log
Mask also all cases of "password(PWD" in CREATE/ALTER USER and GRANT.
(minimal fix)
2024-11-27 19:45:33 +01:00
8b057889d7 MDEV-34981 Functions missing from INFORMATION_SCHEMA.SQL_FUNCTIONS
Plugin functions are now displayed in I_S.SQL_FUNCTIONS
2024-11-27 14:24:52 +04:00
dbfee9fc2b MDEV-34348: Consolidate cmp function declarations
Partial commit of the greater MDEV-34348 scope.
MDEV-34348: MariaDB is violating clang-16 -Wcast-function-type-strict

The functions queue_compare, qsort2_cmp, and qsort_cmp2
all had similar interfaces, and were used interchangable
and unsafely cast to one another.

This patch consolidates the functions all into the
qsort_cmp2 interface.

Reviewed By:
============
Marko Mäkelä <marko.makela@mariadb.com>
2024-11-23 08:14:22 -07:00
cf2d49ddcf Extract some of #3360 fixes to 10.5.x
That PR uncovered countless issues on `my_snprintf` uses.
This commit backports a squashed subset of their fixes.
2024-11-21 22:43:56 +11:00
1d6502b4f4 MDEV-34534 main.plugin_load(daemon_example) - AddressSanitizer: Joining already joined thread, aborting
Joining with a thread that has previously been joined results in undefined behavior.

This example plugin performs the same join to the same thread a few
lines later. ASAN keeps track of this and fails.

Make the behaviour defined by joining only once.

Thanks Vladislav Vaintroub for looking up the behaviour.

While here;
* init/deinit function argument was actually used.
* correct code comments
* attribute define not needed

Thanks Marko Mäkelä for review and suggesting other
fixes.
2024-11-18 22:35:40 +11:00
ed72eadfb8 MDEV-35421 - main.mysql_upgrade fails without unix_socket plugin
Fixed main.mysql_upgrade to pass when unix_socket plugin is unavailable.

Also don't redefine _GNU_SOURCE, which was previously defined by command
line/environment. This fixes silent auth_socket build failure with
MYSQL_MAINTAINER_MODE=ERR.
2024-11-18 14:26:17 +11:00