[SCM] PostGIS branch stable-3.2 updated. 3.2.7-20-g4689ab152
git at osgeo.org
git at osgeo.org
Fri Dec 13 13:22:53 PST 2024
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 4689ab152879b773f7b25932884ac42400bff6d4 (commit)
from 5489123e2aadf702a5237f471d42b7fe64f0d87f (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 4689ab152879b773f7b25932884ac42400bff6d4
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri Dec 13 13:21:13 2024 -0800
Handle null returns from wkb parser
diff --git a/postgis/geography_inout.c b/postgis/geography_inout.c
index a2ff6a280..ad809d9bd 100644
--- a/postgis/geography_inout.c
+++ b/postgis/geography_inout.c
@@ -563,6 +563,11 @@ Datum geography_recv(PG_FUNCTION_ARGS)
}
lwgeom = lwgeom_from_wkb((uint8_t*)buf->data, buf->len, LW_PARSER_CHECK_ALL);
+ if ( !lwgeom )
+ {
+ ereport(ERROR,(errmsg("recv error - invalid geometry")));
+ PG_RETURN_NULL();
+ }
/* Error on any SRID != default */
srid_check_latlong(lwgeom->srid);
diff --git a/postgis/lwgeom_inout.c b/postgis/lwgeom_inout.c
index 55f335893..f9b552749 100644
--- a/postgis/lwgeom_inout.c
+++ b/postgis/lwgeom_inout.c
@@ -133,6 +133,8 @@ Datum LWGEOM_in(PG_FUNCTION_ARGS)
unsigned char *wkb = bytes_from_hexbytes(str, hexsize);
/* TODO: 20101206: No parser checks! This is inline with current 1.5 behavior, but needs discussion */
lwgeom = lwgeom_from_wkb(wkb, hexsize/2, LW_PARSER_CHECK_NONE);
+ /* Parser should throw error, but if not, catch here. */
+ if ( !lwgeom ) PG_RETURN_NULL();
/* If we picked up an SRID at the head of the WKB set it manually */
if ( srid ) lwgeom_set_srid(lwgeom, srid);
/* Add a bbox if necessary */
@@ -698,6 +700,11 @@ Datum LWGEOM_recv(PG_FUNCTION_ARGS)
}
lwgeom = lwgeom_from_wkb((uint8_t*)buf->data, buf->len, LW_PARSER_CHECK_ALL);
+ if ( !lwgeom )
+ {
+ ereport(ERROR,(errmsg("recv error - invalid geometry")));
+ PG_RETURN_NULL();
+ }
if ( lwgeom_needs_bbox(lwgeom) )
lwgeom_add_bbox(lwgeom);
diff --git a/raster/rt_core/rt_gdal.c b/raster/rt_core/rt_gdal.c
index 2b5fbe9c3..950959a67 100644
--- a/raster/rt_core/rt_gdal.c
+++ b/raster/rt_core/rt_gdal.c
@@ -202,6 +202,7 @@ int rt_raster_gdal_contour(
/* Reclaim feature and associated geometry memory */
OGR_F_Destroy(hFeat);
geom = lwgeom_from_wkb(bufWkb, szWkb, LW_PARSER_CHECK_NONE);
+ if (!geom) rterror("%s: invalid wkb", __func__);
lwgeom_set_srid(geom, arg.dst.srid);
contour.geom = gserialized_from_lwgeom(geom, NULL);
lwgeom_free(geom);
diff --git a/raster/rt_core/rt_geometry.c b/raster/rt_core/rt_geometry.c
index 39aee584e..246b1f540 100644
--- a/raster/rt_core/rt_geometry.c
+++ b/raster/rt_core/rt_geometry.c
@@ -1240,6 +1240,7 @@ rt_raster_gdal_polygonize(
/* convert WKB to LWGEOM */
lwgeom = lwgeom_from_wkb(wkb, wkbsize, LW_PARSER_CHECK_NONE);
+ if (!lwgeom) rterror("%s: invalid wkb", __func__);
#if POSTGIS_DEBUG_LEVEL > 3
{
-----------------------------------------------------------------------
Summary of changes:
postgis/geography_inout.c | 5 +++++
postgis/lwgeom_inout.c | 7 +++++++
raster/rt_core/rt_gdal.c | 1 +
raster/rt_core/rt_geometry.c | 1 +
4 files changed, 14 insertions(+)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list