[postgis-tickets] [SCM] PostGIS branch stable-3.0 updated. 3.0.8-13-g72385411f

git at osgeo.org git at osgeo.org
Wed May 17 11:11:33 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.0 has been updated
       via  72385411f024b32c4975f88886c42e3ce3ca032c (commit)
      from  5f1699e180bdc8f6410208fd8d432eb52c6e3a36 (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 72385411f024b32c4975f88886c42e3ce3ca032c
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.
    Closes #5384 in 3.0 branch (3.0.9dev)

diff --git a/NEWS b/NEWS
index 83517db30..98b1da023 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ PostGIS 3.0.9dev
 xxxx/xx/xx
 
 * Bug Fixes *
+
+  - #5384, Fix crash in ST_AsGML when given id is longer than given prefix
+           (Sandro Santilli)
   - #5338, Dump/Restore of raster table fails on
            enforce_coverage_tile_rast constraint (Regina Obe)
   - #5315, #5319, #5320, #5342 crashes on infinite coordinates
diff --git a/postgis/geography_inout.c b/postgis/geography_inout.c
index 55cb1527a..63f43bd35 100644
--- a/postgis/geography_inout.c
+++ b/postgis/geography_inout.c
@@ -287,7 +287,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/Makefile.in b/regress/core/Makefile.in
index eae41c5f1..16f0a3f6a 100644
--- a/regress/core/Makefile.in
+++ b/regress/core/Makefile.in
@@ -105,6 +105,7 @@ TESTS = \
 	orientation \
 	out_geometry \
 	out_geography \
+	out_gml \
 	polygonize \
 	polyhedralsurface \
 	postgis_type_name \
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>

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

Summary of changes:
 NEWS                          | 3 +++
 postgis/geography_inout.c     | 2 +-
 regress/core/Makefile.in      | 1 +
 regress/core/out_gml.sql      | 5 +++++
 regress/core/out_gml_expected | 2 ++
 5 files changed, 12 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