Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
4f63b6cf
Commit
4f63b6cf
authored
Apr 26, 2021
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #31674599: THE UDF_INIT() FUNCTION CAUSE SERVER CRASH
parent
883b723d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
3 deletions
+21
-3
mysql-test/r/udf.result
mysql-test/r/udf.result
+8
-0
mysql-test/t/udf.test
mysql-test/t/udf.test
+10
-0
sql/sql_udf.cc
sql/sql_udf.cc
+3
-3
No files found.
mysql-test/r/udf.result
View file @
4f63b6cf
...
@@ -492,4 +492,12 @@ select * from mysql.plugin WHERE name='unexisting_udf';
...
@@ -492,4 +492,12 @@ select * from mysql.plugin WHERE name='unexisting_udf';
name dl
name dl
DROP FUNCTION unexisting_udf;
DROP FUNCTION unexisting_udf;
ERROR 42000: FUNCTION test.unexisting_udf does not exist
ERROR 42000: FUNCTION test.unexisting_udf does not exist
#
# Bug #31674599: THE UDF_INIT() FUNCTION CAUSE SERVER CRASH
#
call mtr.add_suppression('Invalid row in mysql.func table');
insert mysql.func () values ();
delete from mysql.func where name = '';
#
# End of 10.2 tests
# End of 10.2 tests
#
mysql-test/t/udf.test
View file @
4f63b6cf
...
@@ -562,4 +562,14 @@ select * from mysql.plugin WHERE name='unexisting_udf';
...
@@ -562,4 +562,14 @@ select * from mysql.plugin WHERE name='unexisting_udf';
--
error
ER_SP_DOES_NOT_EXIST
--
error
ER_SP_DOES_NOT_EXIST
DROP
FUNCTION
unexisting_udf
;
DROP
FUNCTION
unexisting_udf
;
--
echo
#
--
echo
# Bug #31674599: THE UDF_INIT() FUNCTION CAUSE SERVER CRASH
--
echo
#
call
mtr
.
add_suppression
(
'Invalid row in mysql.func table'
);
insert
mysql
.
func
()
values
();
source
include
/
restart_mysqld
.
inc
;
delete
from
mysql
.
func
where
name
=
''
;
--
echo
#
--
echo
# End of 10.2 tests
--
echo
# End of 10.2 tests
--
echo
#
sql/sql_udf.cc
View file @
4f63b6cf
...
@@ -196,7 +196,7 @@ void udf_init()
...
@@ -196,7 +196,7 @@ void udf_init()
DBUG_PRINT
(
"info"
,(
"init udf record"
));
DBUG_PRINT
(
"info"
,(
"init udf record"
));
LEX_STRING
name
;
LEX_STRING
name
;
name
.
str
=
get_field
(
&
mem
,
table
->
field
[
0
]);
name
.
str
=
get_field
(
&
mem
,
table
->
field
[
0
]);
name
.
length
=
(
uint
)
strlen
(
name
.
str
);
name
.
length
=
(
uint
)
s
afe_s
trlen
(
name
.
str
);
char
*
dl_name
=
get_field
(
&
mem
,
table
->
field
[
2
]);
char
*
dl_name
=
get_field
(
&
mem
,
table
->
field
[
2
]);
bool
new_dl
=
0
;
bool
new_dl
=
0
;
Item_udftype
udftype
=
UDFTYPE_FUNCTION
;
Item_udftype
udftype
=
UDFTYPE_FUNCTION
;
...
@@ -210,12 +210,12 @@ void udf_init()
...
@@ -210,12 +210,12 @@ void udf_init()
On windows we must check both FN_LIBCHAR and '/'.
On windows we must check both FN_LIBCHAR and '/'.
*/
*/
if
(
check_valid_path
(
dl_name
,
strlen
(
dl_name
))
||
if
(
!
name
.
str
||
!
dl_name
||
check_valid_path
(
dl_name
,
strlen
(
dl_name
))
||
check_string_char_length
(
&
name
,
0
,
NAME_CHAR_LEN
,
check_string_char_length
(
&
name
,
0
,
NAME_CHAR_LEN
,
system_charset_info
,
1
))
system_charset_info
,
1
))
{
{
sql_print_error
(
"Invalid row in mysql.func table for function '%.64s'"
,
sql_print_error
(
"Invalid row in mysql.func table for function '%.64s'"
,
name
.
str
);
safe_str
(
name
.
str
)
);
continue
;
continue
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment