[SCM] PostGIS branch stable-3.1 updated. 3.1.11-12-ge6485c56a
git at osgeo.org
git at osgeo.org
Fri Dec 13 13:26:34 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.1 has been updated
via e6485c56aacc7ca61c28392c2652ba2fb46431cb (commit)
from 57fb5d3124fab2b624a1ee21c980d9beed0c7b95 (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 e6485c56aacc7ca61c28392c2652ba2fb46431cb
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_geometry.c b/raster/rt_core/rt_geometry.c
index 8af91586c..514bcb949 100644
--- a/raster/rt_core/rt_geometry.c
+++ b/raster/rt_core/rt_geometry.c
@@ -1202,6 +1202,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_geometry.c | 1 +
3 files changed, 13 insertions(+)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list