1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00
Alexander Barkov a11e0bccdc MDEV-41530 Assoc array element field as OUT parameter crashes the server
A field of an element of an associative array of RECORDs, passed to
an OUT or INOUT parameter of a stored routine, crashed the server:

  CREATE PROCEDURE p1(a OUT INT) AS BEGIN a:= 7; END;
  DECLARE
    TYPE rec_t IS RECORD (i INT, s VARCHAR(10));
    TYPE tab_t IS TABLE OF rec_t INDEX BY INT;
    t tab_t:= tab_t(1 => rec_t(0, 'x'));
  BEGIN
    p1(t(1).i);
  END;

There were three problems:

- Item_splocal_assoc_array_element_field inherited set_value() of
  Item_splocal_row_field_by_name, which treated the associative array
  variable as a ROW variable (assertion failure in
  sp_rcontext::virtual_tmp_table_for_row()). Added
  Item_splocal_assoc_array_element_field::set_value(), which stores the
  value into the field of the element.
- Before the call, sp_head::bind_input_param() destructed the whole
  variable for an OUT argument, even if the argument was only a part of
  the variable (a ROW field, an assoc array element or its field), so
  the other elements of the array were lost: after p1(a0(2)), the array
  a0(1), a0(2), a0(3) had only one element left. Added
  Item_splocal::is_part_of_variable().
- sp_head::bind_output_param() evaluated the actual argument in the
  context of the callee. For arguments like t(i) or t(i).field this
  resolved the variables t and i in a wrong context. Now the argument
  is evaluated in the context of the caller.

The second problem also affected a SYS_REFCURSOR field of a ROW variable
passed as an OUT argument: the cursors in the other fields of the ROW
variable were closed. Now they are kept.

Known limitations, not changed by this fix:
- The actual OUT argument is evaluated when the value is copied back,
  not when the routine is called. If an earlier OUT argument of the same
  call changes the variable used as the key, as in CALL p(i, a0(i)), the
  new value of the key is used.
- For an OUT argument which is a part of a variable (a ROW field, an
  assoc array element or its field), only the destruct of the whole
  variable is skipped, the part itself is not destructed. A
  SYS_REFCURSOR field of a ROW stays open during the call and is
  released when the new value is copied back.

Tests: sp-assoc-array (OUT and INOUT elements and fields of elements,
NULL key, element deleted by the callee, ROW and RECORD fields) and
type_sys_refcursor-type_row-debug (SYS_REFCURSOR fields of a ROW
variable).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 18:01:29 +04:00
2026-10-07 10:57:35 +02:00
2026-10-07 22:10:46 +02:00
2026-10-07 22:10:46 +02:00
2026-05-08 08:11:03 +02:00
2026-10-07 22:10:46 +02:00
2026-06-15 16:53:03 +02:00
2026-10-07 22:10:46 +02:00
2026-10-07 22:10:46 +02:00
2026-05-26 21:15:58 +02:00
2026-06-15 16:53:03 +02:00
2026-10-07 22:10:46 +02:00
2026-10-07 22:10:46 +02:00
2025-04-29 11:18:00 +10:00
2026-08-20 08:27:14 +02:00
2026-10-13 12:49:13 +03:00
2026-07-30 11:41:55 +02:00
2026-10-07 22:10:46 +02:00
2026-06-15 16:53:03 +02:00
2026-07-30 11:41:55 +02:00
2026-10-07 22:10:46 +02:00
2026-07-30 11:41:55 +02:00
2026-04-24 22:19:40 +02:00
2022-02-03 17:01:31 +01:00
2026-10-07 22:10:46 +02:00
2026-06-15 16:53:03 +02:00
2026-07-28 13:14:38 +02:00
2026-10-07 10:57:35 +02:00
2025-04-29 11:18:00 +10:00
2026-10-07 22:10:46 +02:00
2026-08-20 08:27:14 +02:00
2026-10-07 10:57:35 +02:00
2019-05-11 21:29:06 +03:00
2026-06-15 16:53:03 +02:00
2023-06-05 08:28:06 +10:00
2026-10-05 16:12:56 +02:00

Code status:

  • Appveyor CI status ci.appveyor.com

MariaDB: The innovative open source database

MariaDB was designed as a drop-in replacement for MySQL(R) with more features, new storage engines, fewer bugs, and better performance.

MariaDB is brought to you by the MariaDB Foundation and the MariaDB Corporation. Please read the CREDITS file for details about the MariaDB Foundation, and who is developing MariaDB.

MariaDB is developed by many of the original developers of MySQL who now work for the MariaDB Corporation, the MariaDB Foundation and by many people in the community.

MySQL, which is the base of MariaDB, is a product and trademark of Oracle Corporation, Inc. For a list of developers and other contributors, see the Credits appendix. You can also run 'SHOW authors' to get a list of active contributors.

A description of the MariaDB project and a manual can be found at:

https://mariadb.org

https://mariadb.com/docs/

https://mariadb.com/docs/release-notes/community-server/about/compatibility-and-differences/mariadb-vs-mysql-features

https://mariadb.com/docs/release-notes/community-server/about/compatibility-and-differences/mariadb-vs-mysql-compatibility

https://mariadb.com/docs/release-notes

Getting the code, building it and testing it

Refer to the following guide: https://mariadb.org/get-involved/getting-started-for-developers/get-code-build-test/ which outlines how to build the source code correctly and run the MariaDB testing framework, as well as which branch to target for your contributions.

Help

More help is available from the Maria Discuss mailing list https://lists.mariadb.org/postorius/lists/discuss.lists.mariadb.org/ and MariaDB's Zulip instance, https://mariadb.zulipchat.com/

Licensing


MariaDB is specifically available only under version 2 of the GNU General Public License (GPLv2). (I.e. Without the "any later version" clause.) This is inherited from MySQL. Please see the README file in the MySQL distribution for more information.

License information can be found in the COPYING file. Third party license information can be found in the THIRDPARTY file.


Bug Reports

Bug and/or error reports regarding MariaDB should be submitted at: https://jira.mariadb.org

For reporting security vulnerabilities, see our security-policy.

The code for MariaDB, including all revision history, can be found at: https://github.com/MariaDB/server

Description
Сервер MariaDB - это разработанный сообществом форк сервера MySQL
https://mariadb.org Readme 2.7 GiB
Languages
MariaDB\ 71.8%
C++ 16.5%
C 10.3%
Shell 0.5%
Perl 0.4%
Other 0.3%