From 959dfac4d0e715725d05448a77c08d870d5aa247 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Tue, 19 Jan 2021 15:29:03 +0400 Subject: [PATCH] MDEV-19723 Assertion `je->state == JST_KEY' failed while SELECT ST_GEOMFROMGEOJSON() and Assertion `!mysql_bin_log.is_open() || thd.is_current_stmt_binlog_format_row()' The invalid GeoJSON case wasn't handled here. --- mysql-test/r/gis-json.result | 3 +++ mysql-test/t/gis-json.test | 2 ++ sql/spatial.cc | 1 + 3 files changed, 6 insertions(+) diff --git a/mysql-test/r/gis-json.result b/mysql-test/r/gis-json.result index 1d6e2193fc9..d507a9994ff 100644 --- a/mysql-test/r/gis-json.result +++ b/mysql-test/r/gis-json.result @@ -104,6 +104,9 @@ a NULL Warnings: Warning 4076 Incorrect GeoJSON format - empty 'coordinates' array. +SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }"); +ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }") +NULL # # End of 10.2 tests # diff --git a/mysql-test/t/gis-json.test b/mysql-test/t/gis-json.test index b91ef235fd0..a97e9411e5c 100644 --- a/mysql-test/t/gis-json.test +++ b/mysql-test/t/gis-json.test @@ -44,6 +44,8 @@ SELECT st_astext(st_geomfromgeojson('{"type": "MultiLineString","coordinates": [ SELECT st_astext(st_geomfromgeojson('{"type": "Polygon","coordinates": []}')) as a; SELECT st_astext(st_geomfromgeojson('{"type": "MultiPolygon","coordinates": []}')) as a; +SELECT ST_GEOMFROMGEOJSON("{ \"type\": \"Feature\", \"geometry\": [10, 20] }"); + --echo # --echo # End of 10.2 tests --echo # diff --git a/sql/spatial.cc b/sql/spatial.cc index 83905fc9f3d..840f8bd809c 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -605,6 +605,7 @@ Geometry *Geometry::create_from_json(Geometry_buffer *buffer, if (feature_type_found) goto handle_geometry_key; } + goto err_return; } else {