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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
51d7e803
Commit
51d7e803
authored
Nov 18, 2014
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-4285 Server crashes in ptr_compare on NOW and CAST in ORDER BY
skip qsort if the sort key has zero length
parent
17956118
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
2 deletions
+36
-2
mysql-test/r/order_by_zerolength-4285.result
mysql-test/r/order_by_zerolength-4285.result
+26
-0
mysql-test/t/order_by_zerolength-4285.test
mysql-test/t/order_by_zerolength-4285.test
+8
-0
sql/filesort_utils.cc
sql/filesort_utils.cc
+2
-2
No files found.
mysql-test/r/order_by_zerolength-4285.result
0 → 100644
View file @
51d7e803
create table t1 (pk int primary key);
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
select * from t1 order by now(), cast(pk as char(0));
pk
1
2
3
4
5
6
7
8
9
10
Warnings:
Warning 1292 Truncated incorrect CHAR(0) value: '1'
Warning 1292 Truncated incorrect CHAR(0) value: '2'
Warning 1292 Truncated incorrect CHAR(0) value: '3'
Warning 1292 Truncated incorrect CHAR(0) value: '4'
Warning 1292 Truncated incorrect CHAR(0) value: '5'
Warning 1292 Truncated incorrect CHAR(0) value: '6'
Warning 1292 Truncated incorrect CHAR(0) value: '7'
Warning 1292 Truncated incorrect CHAR(0) value: '8'
Warning 1292 Truncated incorrect CHAR(0) value: '9'
Warning 1292 Truncated incorrect CHAR(0) value: '10'
drop table t1;
mysql-test/t/order_by_zerolength-4285.test
0 → 100644
View file @
51d7e803
#
# MDEV-4285 Server crashes in ptr_compare on NOW and CAST in ORDER BY
#
create
table
t1
(
pk
int
primary
key
);
insert
into
t1
values
(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
),(
9
),(
10
);
select
*
from
t1
order
by
now
(),
cast
(
pk
as
char
(
0
));
drop
table
t1
;
sql/filesort_utils.cc
View file @
51d7e803
...
@@ -125,7 +125,8 @@ void Filesort_buffer::free_sort_buffer()
...
@@ -125,7 +125,8 @@ void Filesort_buffer::free_sort_buffer()
void
Filesort_buffer
::
sort_buffer
(
const
Sort_param
*
param
,
uint
count
)
void
Filesort_buffer
::
sort_buffer
(
const
Sort_param
*
param
,
uint
count
)
{
{
if
(
count
<=
1
)
size_t
size
=
param
->
sort_length
;
if
(
count
<=
1
||
size
==
0
)
return
;
return
;
uchar
**
keys
=
get_sort_keys
();
uchar
**
keys
=
get_sort_keys
();
uchar
**
buffer
=
NULL
;
uchar
**
buffer
=
NULL
;
...
@@ -138,6 +139,5 @@ void Filesort_buffer::sort_buffer(const Sort_param *param, uint count)
...
@@ -138,6 +139,5 @@ void Filesort_buffer::sort_buffer(const Sort_param *param, uint count)
return
;
return
;
}
}
size_t
size
=
param
->
sort_length
;
my_qsort2
(
keys
,
count
,
sizeof
(
uchar
*
),
get_ptr_compare
(
size
),
&
size
);
my_qsort2
(
keys
,
count
,
sizeof
(
uchar
*
),
get_ptr_compare
(
size
),
&
size
);
}
}
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