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
ccaaa3d2
Commit
ccaaa3d2
authored
Jul 29, 2019
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-20200: AddressSanitizer: use-after-poison in Item_direct_view_ref::get_null_ref_table
Do not cast wrong type.
parent
83d368a0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
18 deletions
+51
-18
mysql-test/main/having.result
mysql-test/main/having.result
+9
-0
mysql-test/main/having.test
mysql-test/main/having.test
+13
-0
sql/sql_select.cc
sql/sql_select.cc
+29
-18
No files found.
mysql-test/main/having.result
View file @
ccaaa3d2
...
...
@@ -864,4 +864,13 @@ x
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'x'
DROP TABLE t1,t2;
#
# MDEV-20200: AddressSanitizer: use-after-poison in
# Item_direct_view_ref::get_null_ref_table
#
CREATE TABLE t (f VARCHAR(512));
INSERT INTO t VALUES ('a'),('b');
SELECT * FROM t HAVING f = 'foo';
f
DROP TABLE t;
# End of 10.4 tests
mysql-test/main/having.test
View file @
ccaaa3d2
...
...
@@ -909,4 +909,17 @@ HAVING t.f != 112 AND t.f = 'x' AND t.f != 'a';
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# MDEV-20200: AddressSanitizer: use-after-poison in
--
echo
# Item_direct_view_ref::get_null_ref_table
--
echo
#
CREATE
TABLE
t
(
f
VARCHAR
(
512
));
INSERT
INTO
t
VALUES
(
'a'
),(
'b'
);
SELECT
*
FROM
t
HAVING
f
=
'foo'
;
# Cleanup
DROP
TABLE
t
;
--
echo
# End of 10.4 tests
sql/sql_select.cc
View file @
ccaaa3d2
...
...
@@ -14333,27 +14333,38 @@ bool check_simple_equality(THD *thd, const Item::Context &ctx,
{
Item
*
orig_left_item
=
left_item
;
Item
*
orig_right_item
=
right_item
;
if
(
left_item
->
type
()
==
Item
::
REF_ITEM
&&
(((
Item_ref
*
)
left_item
)
->
ref_type
()
==
Item_ref
::
VIEW_REF
||
((
Item_ref
*
)
left_item
)
->
ref_type
()
==
Item_ref
::
REF
))
if
(
left_item
->
type
()
==
Item
::
REF_ITEM
)
{
if
(((
Item_ref
*
)
left_item
)
->
get_depended_from
())
return
FALSE
;
if
(((
Item_direct_view_ref
*
)
left_item
)
->
get_null_ref_table
()
!=
NO_NULL_TABLE
&&
!
left_item
->
real_item
()
->
used_tables
())
return
FALSE
;
left_item
=
left_item
->
real_item
();
Item_ref
::
Ref_Type
left_ref
=
((
Item_ref
*
)
left_item
)
->
ref_type
();
if
(
left_ref
==
Item_ref
::
VIEW_REF
||
left_ref
==
Item_ref
::
REF
)
{
if
(((
Item_ref
*
)
left_item
)
->
get_depended_from
())
return
FALSE
;
if
(
left_ref
==
Item_ref
::
VIEW_REF
&&
((
Item_direct_view_ref
*
)
left_item
)
->
get_null_ref_table
()
!=
NO_NULL_TABLE
&&
!
left_item
->
real_item
()
->
used_tables
())
return
FALSE
;
left_item
=
left_item
->
real_item
();
}
}
if
(
right_item
->
type
()
==
Item
::
REF_ITEM
&&
(((
Item_ref
*
)
right_item
)
->
ref_type
()
==
Item_ref
::
VIEW_REF
||
((
Item_ref
*
)
right_item
)
->
ref_type
()
==
Item_ref
::
REF
))
if
(
right_item
->
type
()
==
Item
::
REF_ITEM
)
{
if
(((
Item_ref
*
)
right_item
)
->
get_depended_from
())
return
FALSE
;
if
(((
Item_direct_view_ref
*
)
right_item
)
->
get_null_ref_table
()
!=
NO_NULL_TABLE
&&
!
right_item
->
real_item
()
->
used_tables
())
return
FALSE
;
right_item
=
right_item
->
real_item
();
Item_ref
::
Ref_Type
right_ref
=
((
Item_ref
*
)
right_item
)
->
ref_type
();
if
(
right_ref
==
Item_ref
::
VIEW_REF
||
(
right_ref
==
Item_ref
::
REF
))
{
if
(((
Item_ref
*
)
right_item
)
->
get_depended_from
())
return
FALSE
;
if
(
right_ref
==
Item_ref
::
VIEW_REF
&&
((
Item_direct_view_ref
*
)
right_item
)
->
get_null_ref_table
()
!=
NO_NULL_TABLE
&&
!
right_item
->
real_item
()
->
used_tables
())
return
FALSE
;
right_item
=
right_item
->
real_item
();
}
}
if
(
left_item
->
type
()
==
Item
::
FIELD_ITEM
&&
right_item
->
type
()
==
Item
::
FIELD_ITEM
&&
...
...
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