Commit 4a35a3b5 authored by Andre Alves's avatar Andre Alves Committed by Andrew Hutchings

MDEV-33659 Server crashed at Create_func_aes_decrypt::create_native

parent 0b8c5d74
...@@ -5594,5 +5594,12 @@ aes_encrypt(a,a) is null ...@@ -5594,5 +5594,12 @@ aes_encrypt(a,a) is null
1 1
0 0
# #
# MDEV-33659: Server crashed at Create_func_aes_decrypt::create_native
#
select aes_encrypt();
ERROR 42000: Incorrect parameter count in the call to native function 'aes_encrypt'
select aes_decrypt();
ERROR 42000: Incorrect parameter count in the call to native function 'aes_decrypt'
#
# End of 11.2 tests # End of 11.2 tests
# #
...@@ -2522,6 +2522,15 @@ set @@block_encryption_mode=default; ...@@ -2522,6 +2522,15 @@ set @@block_encryption_mode=default;
--echo # --echo #
select aes_encrypt(a,a) is null from (values('a'),(NULL),('b')) x; select aes_encrypt(a,a) is null from (values('a'),(NULL),('b')) x;
--echo #
--echo # MDEV-33659: Server crashed at Create_func_aes_decrypt::create_native
--echo #
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
select aes_encrypt();
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
select aes_decrypt();
--echo # --echo #
--echo # End of 11.2 tests --echo # End of 11.2 tests
--echo # --echo #
...@@ -3167,8 +3167,12 @@ Item* ...@@ -3167,8 +3167,12 @@ Item*
Create_func_aes_encrypt::create_native(THD *thd, const LEX_CSTRING *name, Create_func_aes_encrypt::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list) List<Item> *item_list)
{ {
uint arg_count= item_list->elements;
Item *a[4]; Item *a[4];
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++) for (uint i=0; i < MY_MIN(array_elements(a), arg_count); i++)
a[i]= item_list->pop(); a[i]= item_list->pop();
switch (arg_count) switch (arg_count)
...@@ -3191,8 +3195,12 @@ Item* ...@@ -3191,8 +3195,12 @@ Item*
Create_func_aes_decrypt::create_native(THD *thd, const LEX_CSTRING *name, Create_func_aes_decrypt::create_native(THD *thd, const LEX_CSTRING *name,
List<Item> *item_list) List<Item> *item_list)
{ {
uint arg_count= item_list->elements;
Item *a[4]; Item *a[4];
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++) for (uint i=0; i < MY_MIN(array_elements(a), arg_count); i++)
a[i]= item_list->pop(); a[i]= item_list->pop();
switch (arg_count) 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