[postgis-tickets] [SCM] PostGIS branch stable-3.4 updated. 3.4.0-28-g59654b1aa

git at osgeo.org git at osgeo.org
Mon Sep 18 12:35:32 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.4 has been updated
       via  59654b1aa9f01d6fb2689ab5658f43ab250aabad (commit)
      from  e3649bd337915c82b8e959dbefeeb807c73e556a (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 59654b1aa9f01d6fb2689ab5658f43ab250aabad
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Sep 18 12:31:35 2023 -0700

    Avoid reading past the end of varlena_t data buffer

diff --git a/NEWS b/NEWS
index 80176ad62..961afb6c6 100644
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,7 @@ To take advantage of all SFCGAL featurs, SFCGAL 1.4.1+ is needed.
           warn of deprecated SRID: 2163 (Regina Obe)
  - Include elevation in output of ST_Contour when in polygonal mode (Paul Ramsey)
  - #5482, New Proj output is only available for proj 7.1+ (Regina Obe)
+ - Fix JsonB casting issue (Paul Ramsey)
 
 * Enhancements *
 
diff --git a/postgis/lwgeom_export.c b/postgis/lwgeom_export.c
index 8bc9c1916..e2d8731dc 100644
--- a/postgis/lwgeom_export.c
+++ b/postgis/lwgeom_export.c
@@ -286,6 +286,7 @@ Datum geometry_to_jsonb(PG_FUNCTION_ARGS)
 	GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
 	LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
 	const char *srs = NULL;
+	char *cstr;
 	lwvarlena_t *geojson;
 	if (lwgeom->srid != SRID_UNKNOWN)
 	{
@@ -294,7 +295,9 @@ Datum geometry_to_jsonb(PG_FUNCTION_ARGS)
 	}
 	geojson = lwgeom_to_geojson(lwgeom, srs, 15, 0);
 	lwgeom_free(lwgeom);
-	PG_RETURN_DATUM(DirectFunctionCall1(jsonb_in, PointerGetDatum(text_to_cstring(geojson))));
+	cstr = palloc0(VARSIZE_ANY_EXHDR(geojson) + 1);
+	memcpy(cstr, VARDATA(geojson), VARSIZE_ANY_EXHDR(geojson));
+	PG_RETURN_DATUM(DirectFunctionCall1(jsonb_in, PointerGetDatum(cstr)));
 }
 
 

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

Summary of changes:
 NEWS                    | 1 +
 postgis/lwgeom_export.c | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list