[postgis-tickets] [SCM] PostGIS branch stable-3.2 updated. 3.2.5-13-g9eebe16c3

git at osgeo.org git at osgeo.org
Mon Sep 18 12:35:10 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  9eebe16c318e8ea082be359ec1fe5ed8645fc38d (commit)
      from  3c4048d78d167f4b5fe29ac484752d2641ef6fbf (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 9eebe16c318e8ea082be359ec1fe5ed8645fc38d
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Sep 18 12:32:27 2023 -0700

    Avoid reading past the end of varlena_t data buffer

diff --git a/NEWS b/NEWS
index 90f319052..b61bebba3 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,8 @@ Proj 6.1+, and PostgreSQL 14+.
   - #5385, Postgres malloc assertion fail when
            using pg_cancel_backend with ST_AsMVT
            (Regina Obe, Paul Ramsey)
+ - Fix JsonB casting issue (Paul Ramsey)
+
 
 * Breaking Changes *
     - #5385, Take out interruptability of ST_AsMVT
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                    | 2 ++
 postgis/lwgeom_export.c | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list