[postgis-tickets] [SCM] PostGIS branch stable-3.1 updated. 3.1.8-18-g44507e022

git at osgeo.org git at osgeo.org
Wed May 17 11:19:04 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.1 has been updated
       via  44507e022295df4ff15ab1e3a4bfbb71cfd6c739 (commit)
      from  d1fc0f7ae4e61fe5aba3238c7d785a9a837af8c6 (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 44507e022295df4ff15ab1e3a4bfbb71cfd6c739
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.1 branch (3.1.9dev)

diff --git a/NEWS b/NEWS
index c4b1300c7..cdeba9ca8 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ PostGIS 3.1.9dev
 xxxx/xx/xx
 
 * 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)
   - #5338, Dump/Restore of raster table fails on
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 acdfeccde..eff5a8925 100644
--- a/regress/core/tests.mk.in
+++ b/regress/core/tests.mk.in
@@ -58,6 +58,7 @@ TESTS += \
 	$(topsrcdir)/regress/core/orientation \
 	$(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