diff options
author | Alexey Botchkov <holyfoot@mysql.com> | 2011-01-12 17:02:41 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@mysql.com> | 2011-01-12 17:02:41 +0400 |
commit | e073e2c0be3860eafd08b2ab14c8490dcb3b05fc (patch) | |
tree | 17d980b58a1a1957b0b01acc39d03c44deb33034 | |
parent | 94fbedd3e3f17a624c5e66f3914b67d9f46d1b2b (diff) | |
download | mariadb-git-e073e2c0be3860eafd08b2ab14c8490dcb3b05fc.tar.gz |
Bug #57321 crashes and valgrind errors from spatial types
Item_func_spatial_collection::fix_length_and_dec didn't call parent's method, so
the maybe_null was set to '0' after it. But in this case the result was
just NULL, that caused wrong behaviour.
per-file comments:
mysql-test/r/gis.result
Bug #57321 crashes and valgrind errors from spatial types
test result updated.
mysql-test/t/gis.test
Bug #57321 crashes and valgrind errors from spatial types
test case added.
sql/item_geofunc.h
Bug #57321 crashes and valgrind errors from spatial types
Item_func_geometry::fix_length_and_dec() called in
Item_func_spatial_collection::fix_length_and_dec().
-rw-r--r-- | mysql-test/r/gis.result | 8 | ||||
-rw-r--r-- | mysql-test/t/gis.test | 10 | ||||
-rw-r--r-- | sql/item_geofunc.h | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 3b18ee61336..f4aa361ffcf 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -1014,4 +1014,12 @@ SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000 SET @a=POLYFROMWKB(@a); SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; SET @a=POLYFROMWKB(@a); +create table t1(a polygon NOT NULL)engine=myisam; +insert into t1 values (geomfromtext("point(0 1)")); +insert into t1 values (geomfromtext("point(1 0)")); +select * from (select polygon(t1.a) as p from t1 order by t1.a) d; +p +NULL +NULL +drop table t1; End of 5.1 tests diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index fd0a18ab4dd..97fc6f94b6a 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -744,4 +744,14 @@ SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000 SET @a=POLYFROMWKB(@a); +# +# Bug #57321 crashes and valgrind errors from spatial types +# + +create table t1(a polygon NOT NULL)engine=myisam; +insert into t1 values (geomfromtext("point(0 1)")); +insert into t1 values (geomfromtext("point(1 0)")); +select * from (select polygon(t1.a) as p from t1 order by t1.a) d; +drop table t1; + --echo End of 5.1 tests diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index b3ecbc39933..08161badfd3 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -177,6 +177,7 @@ public: String *val_str(String *); void fix_length_and_dec() { + Item_geometry_func::fix_length_and_dec(); for (unsigned int i= 0; i < arg_count; ++i) { if (args[i]->fixed && args[i]->field_type() != MYSQL_TYPE_GEOMETRY) |