Commit 7cc2f8de authored by Sergei Golubchik's avatar Sergei Golubchik

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.
parent d1182965
...@@ -1182,5 +1182,11 @@ a 256 ...@@ -1182,5 +1182,11 @@ a 256
Warnings: Warnings:
Warning 1260 Row 1 was cut by GROUP_CONCAT() 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 # End of 5.5 tests
# #
...@@ -854,6 +854,11 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1 ...@@ -854,6 +854,11 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
GROUP BY id GROUP BY id
ORDER BY l DESC; 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 #
--echo # End of 5.5 tests --echo # End of 5.5 tests
......
...@@ -135,6 +135,7 @@ String *Item_func_as_wkt::val_str_ascii(String *str) ...@@ -135,6 +135,7 @@ String *Item_func_as_wkt::val_str_ascii(String *str)
return 0; return 0;
str->length(0); str->length(0);
str->set_charset(&my_charset_latin1);
if ((null_value= geom->as_wkt(str, &dummy))) if ((null_value= geom->as_wkt(str, &dummy)))
return 0; return 0;
...@@ -182,7 +183,7 @@ String *Item_func_geometry_type::val_str_ascii(String *str) ...@@ -182,7 +183,7 @@ String *Item_func_geometry_type::val_str_ascii(String *str)
/* String will not move */ /* String will not move */
str->copy(geom->get_class_info()->m_name.str, str->copy(geom->get_class_info()->m_name.str,
geom->get_class_info()->m_name.length, geom->get_class_info()->m_name.length,
default_charset()); &my_charset_latin1);
return str; return str;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment