[postgis-tickets] [SCM] PostGIS branch stable-3.0 updated. 3.0.2-11-gc74c522
git at osgeo.org
git at osgeo.org
Fri Oct 23 04:48:00 PDT 2020
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.0 has been updated
via c74c522066006fa295645138557320678d2a59b7 (commit)
from 73dd48b9cafffdb7012caa29e22cdf9d8c964b0e (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 c74c522066006fa295645138557320678d2a59b7
Author: Raúl Marín <git at rmr.ninja>
Date: Sun Oct 18 00:01:33 2020 +0200
Fix segfault when parsing invalid WKB
References #4767 #4768 #4771 #4772
diff --git a/NEWS b/NEWS
index 0fc43d0..6905de6 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ PostGIS 3.0.3dev
- #4719, Fail fast when srids don't match ST_Intersection(geometry,raster)
Also schema qualify calls in function. (Regina Obe)
- #4739, Ensure all functions using postgis_oid initialize the internal cache (Raúl Marín)
+ - #4767, #4768, #4771, #4772, Fix segfault when parsing invalid WKB (Raúl Marín)
PostGIS 3.0.2
2020/08/15
diff --git a/postgis/lwgeom_inout.c b/postgis/lwgeom_inout.c
index be4b2ee..8fa7ce8 100644
--- a/postgis/lwgeom_inout.c
+++ b/postgis/lwgeom_inout.c
@@ -374,6 +374,8 @@ Datum LWGEOMFromEWKB(PG_FUNCTION_ARGS)
uint8_t *wkb = (uint8_t*)VARDATA(bytea_wkb);
lwgeom = lwgeom_from_wkb(wkb, VARSIZE_ANY_EXHDR(bytea_wkb), LW_PARSER_CHECK_ALL);
+ if (!lwgeom)
+ lwpgerror("Unable to parse WKB");
if ((PG_NARGS() > 1) && (!PG_ARGISNULL(1)))
{
diff --git a/postgis/lwgeom_ogc.c b/postgis/lwgeom_ogc.c
index 08ab516..4c37ecc 100644
--- a/postgis/lwgeom_ogc.c
+++ b/postgis/lwgeom_ogc.c
@@ -794,9 +794,8 @@ Datum LWGEOM_from_WKB(PG_FUNCTION_ARGS)
uint8_t *wkb = (uint8_t*)VARDATA(bytea_wkb);
lwgeom = lwgeom_from_wkb(wkb, VARSIZE_ANY_EXHDR(bytea_wkb), LW_PARSER_CHECK_ALL);
-
- if ( lwgeom_needs_bbox(lwgeom) )
- lwgeom_add_bbox(lwgeom);
+ if (!lwgeom)
+ lwpgerror("Unable to parse WKB");
geom = geometry_serialize(lwgeom);
lwgeom_free(lwgeom);
diff --git a/regress/core/wkb.sql b/regress/core/wkb.sql
index 9749db5..2fd59bf 100644
--- a/regress/core/wkb.sql
+++ b/regress/core/wkb.sql
@@ -533,3 +533,13 @@ select g, encode(st_asbinary(g::geometry, 'ndr'), 'hex'),
'TIN ZM EMPTY'
::text as g ) as foo;
+
+-- Crashes (#4767, #4768, #4771, #4772)
+SELECT st_mpointfromwkb('\x'::BYTEA);
+SELECT geometry('\x'::bytea);
+SELECT st_geomcollfromwkb('\x'::bytea);
+SELECT st_geomfromewkb('\x'::bytea);
+SELECT st_wkbtosql('\x');
+SELECT st_mpolyfromwkb('\x'::BYTEA);
+SELECT st_mlinefromwkb('\x'::bytea);
+SELECT st_mlinefromwkb('\x'::bytea,1);
\ No newline at end of file
diff --git a/regress/core/wkb_expected b/regress/core/wkb_expected
index 91fa0c8..090e646 100644
--- a/regress/core/wkb_expected
+++ b/regress/core/wkb_expected
@@ -99,3 +99,11 @@ TIN EMPTY|011000000000000000|t|000000001000000000
TIN Z EMPTY|01f803000000000000|t|00000003f800000000
TIN M EMPTY|01e007000000000000|t|00000007e000000000
TIN ZM EMPTY|01c80b000000000000|t|0000000bc800000000
+ERROR: Unable to parse WKB
+ERROR: Unable to parse WKB
+ERROR: Unable to parse WKB
+ERROR: Unable to parse WKB
+ERROR: Unable to parse WKB
+ERROR: Unable to parse WKB
+ERROR: Unable to parse WKB
+ERROR: Unable to parse WKB
-----------------------------------------------------------------------
Summary of changes:
NEWS | 1 +
postgis/lwgeom_inout.c | 2 ++
postgis/lwgeom_ogc.c | 5 ++---
regress/core/wkb.sql | 10 ++++++++++
regress/core/wkb_expected | 8 ++++++++
5 files changed, 23 insertions(+), 3 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list