summaryrefslogtreecommitdiff
path: root/sql/item_geofunc.cc
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2009-10-21 11:43:45 +0300
committerGeorgi Kodinov <joro@sun.com>2009-10-21 11:43:45 +0300
commit19ffe2308542735bc37e070bbdf266281ea8156a (patch)
tree4736457765d2b9e443a04853d31af50aa2f2d633 /sql/item_geofunc.cc
parentb7ce2a01bc7cdf7984cbd12848f7f61c2f582a89 (diff)
downloadmariadb-git-19ffe2308542735bc37e070bbdf266281ea8156a.tar.gz
Bug #47780: crash when comparing GIS items from subquery
If the first argument to GeomFromWKB function is a geometry field then the function just returns its value. However in doing so it's not preserving first argument's null_value flag and this causes unexpected null value to be returned to the calling function. Fixed by updating the null_value of the GeomFromWKB function in such cases (and all other cases that return a NULL e.g. because of not enough memory for the return buffer).
Diffstat (limited to 'sql/item_geofunc.cc')
-rw-r--r--sql/item_geofunc.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index 71bd1347f6e..d3e7096a0bd 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -76,7 +76,9 @@ String *Item_func_geometry_from_wkb::val_str(String *str)
if (args[0]->field_type() == MYSQL_TYPE_GEOMETRY)
{
- return args[0]->val_str(str);
+ String *str_ret= args[0]->val_str(str);
+ null_value= args[0]->null_value;
+ return str_ret;
}
wkb= args[0]->val_str(&arg_val);
@@ -86,7 +88,10 @@ String *Item_func_geometry_from_wkb::val_str(String *str)
str->set_charset(&my_charset_bin);
if (str->reserve(SRID_SIZE, 512))
- return 0;
+ {
+ null_value= TRUE; /* purecov: inspected */
+ return 0; /* purecov: inspected */
+ }
str->length(0);
str->q_append(srid);
if ((null_value=