Commit 435a10e4 authored by Andre Alves's avatar Andre Alves Committed by Andrew Hutchings

MDEV-33659 Fix crash in kdf() without parameters

parent 9d806a0f
......@@ -154,5 +154,10 @@ NULL
Warnings:
Warning 3047 Invalid argument error: 65537 in function kdf.
#
# MDEV-33659 Test kdf() without parameters
#
select kdf();
ERROR 42000: Incorrect parameter count in the call to native function 'kdf'
#
# End of 11.3 tests
#
......@@ -51,6 +51,13 @@ select length(kdf('foo', 'bar', 100, 'pbkdf2_hmac', 32768));
select length(kdf('foo', 'bar', 100, 'pbkdf2_hmac', 65536));
select length(kdf('foo', 'bar', 100, 'pbkdf2_hmac', 65537));
--echo #
--echo # MDEV-33659 Test kdf() without parameters
--echo #
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
select kdf();
--echo #
--echo # End of 11.3 tests
--echo #
......
......@@ -3229,8 +3229,12 @@ Item*
Create_func_kdf::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list)
{
uint arg_count= item_list->elements;
Item *a[5];
uint arg_count= 0;
if (item_list != NULL)
arg_count= item_list->elements;
for (uint i=0; i < MY_MIN(array_elements(a), arg_count); i++)
a[i]= item_list->pop();
switch (arg_count)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment