summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-08-09 18:25:47 +0200
committerSergei Golubchik <sergii@pisem.net>2012-08-09 18:25:47 +0200
commit7cc2f8decabe83fb304458748ba907f011848309 (patch)
treeec02a2a082252b3c88ada39e48e90c6316ae8144
parentd11829654c4ef5c3d0f997ca61a50d4bd196db8a (diff)
downloadmariadb-git-7cc2f8decabe83fb304458748ba907f011848309.tar.gz
fix val_str_ascii to return a string in the ascii-compatible charset.
two items didn't do that properly, one was exploitable, the other was not, but fixed anyway.
-rw-r--r--mysql-test/r/ctype_utf32.result6
-rw-r--r--mysql-test/t/ctype_utf32.test5
-rw-r--r--sql/item_geofunc.cc3
3 files changed, 13 insertions, 1 deletions
diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result
index 03f60261450..6cf24d768f7 100644
--- a/mysql-test/r/ctype_utf32.result
+++ b/mysql-test/r/ctype_utf32.result
@@ -1182,5 +1182,11 @@ a 256
Warnings:
Warning 1260 Row 1 was cut by GROUP_CONCAT()
#
+# incorrect charset for val_str_ascii
+#
+SELECT '2010-10-10 10:10:10' + INTERVAL GeometryType(GeomFromText('POINT(1 1)')) hour_second;
+'2010-10-10 10:10:10' + INTERVAL GeometryType(GeomFromText('POINT(1 1)')) hour_second
+2010-10-10 10:10:10
+#
# End of 5.5 tests
#
diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test
index 5fc01e4467e..91221b4f7c7 100644
--- a/mysql-test/t/ctype_utf32.test
+++ b/mysql-test/t/ctype_utf32.test
@@ -854,6 +854,11 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
GROUP BY id
ORDER BY l DESC;
+--echo #
+--echo # incorrect charset for val_str_ascii
+--echo #
+
+SELECT '2010-10-10 10:10:10' + INTERVAL GeometryType(GeomFromText('POINT(1 1)')) hour_second;
--echo #
--echo # End of 5.5 tests
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index fdd3cab8273..3648b10af3f 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -135,6 +135,7 @@ String *Item_func_as_wkt::val_str_ascii(String *str)
return 0;
str->length(0);
+ str->set_charset(&my_charset_latin1);
if ((null_value= geom->as_wkt(str, &dummy)))
return 0;
@@ -182,7 +183,7 @@ String *Item_func_geometry_type::val_str_ascii(String *str)
/* String will not move */
str->copy(geom->get_class_info()->m_name.str,
geom->get_class_info()->m_name.length,
- default_charset());
+ &my_charset_latin1);
return str;
}