[postgis-tickets] [SCM] PostGIS branch stable-3.2 updated. 3.2.4-27-g558445243

git at osgeo.org git at osgeo.org
Wed May 17 11:24:19 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.2 has been updated
       via  55844524313d62512098557190cc38ddafd101e3 (commit)
      from  d04d1fc9f0c99ca5fce006ae43af03e7de197351 (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 55844524313d62512098557190cc38ddafd101e3
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.2 branch (3.2.5dev)

diff --git a/NEWS b/NEWS
index a8b3917cc..4ee3cd288 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@ Additional features are enabled if you are running GEOS 3.9+
 Proj 6.1+, and PostgreSQL 14+.
 
 * 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)
   - #5106, Fix segfault in ST_RemEdgeNewFace/ST_RemEdgeModFace
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 31663725d..38b9c3547 100644
--- a/regress/core/tests.mk.in
+++ b/regress/core/tests.mk.in
@@ -65,6 +65,7 @@ TESTS += \
 	$(topsrcdir)/regress/core/out_flatgeobuf \
 	$(topsrcdir)/regress/core/out_geometry \
 	$(topsrcdir)/regress/core/out_geography \
+	$(topsrcdir)/regress/core/out_gml \
 	$(topsrcdir)/regress/core/polygonize \
 	$(topsrcdir)/regress/core/polyhedralsurface \
 	$(topsrcdir)/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