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
a765cca6
Commit
a765cca6
authored
Jun 08, 2015
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-8067 correct fix for MySQL Bug # 19699237: UNINITIALIZED VARIABLE IN ITEM_FIELD::STR_RESULT
parent
b37b52a3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
0 deletions
+62
-0
mysql-test/r/ctype_utf8.result
mysql-test/r/ctype_utf8.result
+15
-0
mysql-test/t/ctype_utf8.test
mysql-test/t/ctype_utf8.test
+16
-0
sql/item.cc
sql/item.cc
+30
-0
sql/item.h
sql/item.h
+1
-0
No files found.
mysql-test/r/ctype_utf8.result
View file @
a765cca6
...
...
@@ -5762,5 +5762,20 @@ DROP TABLE t1;
# End of ctype_utf8_ilseq.inc
#
#
# MDEV-8067 correct fix for MySQL Bug # 19699237: UNINITIALIZED VARIABLE IN ITEM_FIELD::STR_RESULT
#
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8);
CREATE TABLE t2 (a VARCHAR(10) CHARACTER SET latin1);
INSERT INTO t1 VALUES ('aaa');
INSERT INTO t2 VALUES ('aaa');
SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
(SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2)
1
INSERT INTO t1 VALUES ('aaa');
INSERT INTO t2 VALUES ('aaa');
SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
ERROR 21000: Subquery returns more than 1 row
DROP TABLE t1, t2;
#
# End of 5.5 tests
#
mysql-test/t/ctype_utf8.test
View file @
a765cca6
...
...
@@ -1616,6 +1616,22 @@ SET NAMES utf8 COLLATE utf8_general_ci;
--
let
ENGINE
=
HEAP
--
source
include
/
ctype_utf8_ilseq
.
inc
--
echo
#
--
echo
# MDEV-8067 correct fix for MySQL Bug # 19699237: UNINITIALIZED VARIABLE IN ITEM_FIELD::STR_RESULT
--
echo
#
CREATE
TABLE
t1
(
a
VARCHAR
(
10
)
CHARACTER
SET
utf8
);
CREATE
TABLE
t2
(
a
VARCHAR
(
10
)
CHARACTER
SET
latin1
);
INSERT
INTO
t1
VALUES
(
'aaa'
);
INSERT
INTO
t2
VALUES
(
'aaa'
);
SELECT
(
SELECT
CONCAT
(
a
),
1
FROM
t1
)
<=>
(
SELECT
CONCAT
(
a
),
1
FROM
t2
);
INSERT
INTO
t1
VALUES
(
'aaa'
);
INSERT
INTO
t2
VALUES
(
'aaa'
);
# Running the below query crashed with two rows
--
error
ER_SUBQUERY_NO_1_ROW
SELECT
(
SELECT
CONCAT
(
a
),
1
FROM
t1
)
<=>
(
SELECT
CONCAT
(
a
),
1
FROM
t2
);
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# End of 5.5 tests
--
echo
#
sql/item.cc
View file @
a765cca6
...
...
@@ -1135,6 +1135,36 @@ Item *Item::safe_charset_converter(CHARSET_INFO *tocs)
}
/**
Some pieces of the code do not support changing of
Item_cache to other Item types.
Example:
Item_singlerow_subselect has "Item_cache **row".
Creating of Item_func_conv_charset followed by THD::change_item_tree()
should not change row[i] from Item_cache directly to Item_func_conv_charset, because Item_singlerow_subselect
because Item_singlerow_subselect later calls Item_cache-specific methods,
e.g. row[i]->store() and row[i]->cache_value().
Let's wrap Item_func_conv_charset to a new Item_cache,
so the Item_cache-specific methods can still be used for
Item_singlerow_subselect::row[i] safely.
TODO: we should eventually check all other use cases of change_item_tree().
Perhaps some more potentially dangerous substitution examples exist.
*/
Item
*
Item_cache
::
safe_charset_converter
(
CHARSET_INFO
*
tocs
)
{
Item_func_conv_charset
*
conv
=
new
Item_func_conv_charset
(
example
,
tocs
,
1
);
Item_cache
*
cache
;
if
(
!
conv
||
!
conv
->
safe
||
!
(
cache
=
new
Item_cache_str
(
conv
)))
return
NULL
;
// Safe conversion is not possible, or OEM
cache
->
setup
(
conv
);
cache
->
fixed
=
false
;
// Make Item::fix_fields() happy
return
cache
;
}
/**
@details
Created mostly for mysql_prepare_table(). Important
...
...
sql/item.h
View file @
a765cca6
...
...
@@ -4161,6 +4161,7 @@ class Item_cache: public Item_basic_constant
return
TRUE
;
return
(
this
->*
processor
)(
arg
);
}
virtual
Item
*
safe_charset_converter
(
CHARSET_INFO
*
tocs
);
};
...
...
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