[SCM] PostGIS branch stable-3.4 updated. 3.4.3-18-g491faa9c8
git at osgeo.org
git at osgeo.org
Fri Dec 13 13:22:24 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.4 has been updated
via 491faa9c8038ff22b3e050cf979fdd2ba8ab03af (commit)
from 3779b5ae9d956a822c3712990807cd9865e9c4f8 (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 491faa9c8038ff22b3e050cf979fdd2ba8ab03af
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 95038b256..90a509a99 100644
--- a/raster/rt_core/rt_gdal.c
+++ b/raster/rt_core/rt_gdal.c
@@ -284,6 +284,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 a114457da..c55b9d440 100644
--- a/raster/rt_core/rt_geometry.c
+++ b/raster/rt_core/rt_geometry.c
@@ -1232,6 +1232,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