[postgis-tickets] [SCM] PostGIS branch stable-3.3 updated. 3.3.2-60-ga30303925

git at osgeo.org git at osgeo.org
Wed May 17 11:30:18 PDT 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, stable-3.3 has been updated
       via  a30303925d6226b96b2d37a6aed233058ba90558 (commit)
      from  2178cade6c7703b1d3953973f308f21c015fa342 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a30303925d6226b96b2d37a6aed233058ba90558
Author: Sandro Santilli <strk at kbt.io>
Date:   Wed May 17 19:39:16 2023 +0200

    Fix crash in ST_AsGML when given id is longer than given prefix
    
    Includes regress test.
    References #5384 in 3.3 branch (3.3.3dev)

diff --git a/NEWS b/NEWS
index 74b77e509..7c944a145 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ PostGIS 3.3.3dev
 YYYY/MM/DD
 
 * Bug Fixes *
+  - #5384, Fix crash in ST_AsGML when given id is longer than given prefix
+           (Sandro Santilli)
   - #5380, Fix 2.5 upgrades with views using geography based ST_Distance
            (Sandro Santilli)
   - #5303, Don't try removing closed edges endpoint from
diff --git a/postgis/geography_inout.c b/postgis/geography_inout.c
index 4e62e0b10..ea3c81379 100644
--- a/postgis/geography_inout.c
+++ b/postgis/geography_inout.c
@@ -273,7 +273,7 @@ Datum geography_as_gml(PG_FUNCTION_ARGS)
 	{
 		id_buf = palloc(VARSIZE_ANY_EXHDR(id_text)+1);
 		memcpy(id_buf, VARDATA(id_text), VARSIZE_ANY_EXHDR(id_text));
-		prefix_buf[VARSIZE_ANY_EXHDR(id_text)+1] = '\0';
+		id_buf[VARSIZE_ANY_EXHDR(id_text)+1] = '\0';
 		id = id_buf;
 	}
 
diff --git a/regress/core/out_gml.sql b/regress/core/out_gml.sql
new file mode 100644
index 000000000..6e2bd4099
--- /dev/null
+++ b/regress/core/out_gml.sql
@@ -0,0 +1,5 @@
+-- TODO: move all ST_AsGML tests here
+
+-- #5384
+SELECT '#5384.geom', ST_AsGML('POINT(0 0)'::geometry, 15, 0, '', '1');
+SELECT '#5384.geog', ST_AsGML('POINT(0 0)'::geography, 15, 0, '', '1');
diff --git a/regress/core/out_gml_expected b/regress/core/out_gml_expected
new file mode 100644
index 000000000..bab0eca7b
--- /dev/null
+++ b/regress/core/out_gml_expected
@@ -0,0 +1,2 @@
+#5384.geom|<Point srsName="EPSG:4326"><coordinates>0,0</coordinates></Point>
+#5384.geog|<Point srsName="EPSG:4326"><coordinates>0,0</coordinates></Point>
diff --git a/regress/core/tests.mk.in b/regress/core/tests.mk.in
index 8057e8704..56b6e8edf 100644
--- a/regress/core/tests.mk.in
+++ b/regress/core/tests.mk.in
@@ -67,6 +67,7 @@ TESTS += \
 	$(top_srcdir)/regress/core/out_flatgeobuf \
 	$(top_srcdir)/regress/core/out_geometry \
 	$(top_srcdir)/regress/core/out_geography \
+	$(top_srcdir)/regress/core/out_gml \
 	$(top_srcdir)/regress/core/polygonize \
 	$(top_srcdir)/regress/core/polyhedralsurface \
 	$(top_srcdir)/regress/core/postgis_type_name \

-----------------------------------------------------------------------

Summary of changes:
 NEWS                          | 2 ++
 postgis/geography_inout.c     | 2 +-
 regress/core/out_gml.sql      | 5 +++++
 regress/core/out_gml_expected | 2 ++
 regress/core/tests.mk.in      | 1 +
 5 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 regress/core/out_gml.sql
 create mode 100644 regress/core/out_gml_expected


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list