[postgis-tickets] [SCM] PostGIS branch master updated. 3.4.0rc1-580-ga980403f8

git at osgeo.org git at osgeo.org
Mon Sep 18 12:36:03 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, master has been updated
       via  a980403f8242bc6f0e0ed35af04d9d2cf0d01328 (commit)
      from  10ca8226123ad9783d9af40fc2cc4e2455620abc (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 a980403f8242bc6f0e0ed35af04d9d2cf0d01328
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Sep 18 12:22:03 2023 -0700

    Avoid casting varlena_t to text

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:
 postgis/lwgeom_export.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list