[postgis-tickets] [PostGIS] #5173: st_asflatgeobuf detoast crash
PostGIS
trac at osgeo.org
Sat Jun 18 16:51:17 PDT 2022
#5173: st_asflatgeobuf detoast crash
---------------------+---------------------------
Reporter: robe | Owner: pramsey
Type: defect | Status: new
Priority: blocker | Milestone: PostGIS 3.2.2
Component: postgis | Version: 3.2.x
Keywords: |
---------------------+---------------------------
Noted on postgis dev mailing list:
https://lists.osgeo.org/pipermail/postgis-devel/2022-June/029687.html
and patch at
https://lists.osgeo.org/pipermail/postgis-devel/2022-June/029689.html
{{{
Hi,
On Sat, Jun 18, 2022 at 06:52:10AM -0500, Justin Pryzby wrote:
> An instance running pg15beta1 crashed while running one of sqlsmith's
appalling
> queries. I reproduced with this, simplified query:
>
> select st_asflatgeobuf(row(1), false, '')
> over () from information_schema.table_privileges
>
> Program terminated with signal 11, Segmentation fault.
> #0 pg_detoast_datum_copy (datum=0x514) at fmgr.c:1719
All versions of st_asflatgeobuf have the same problem, so you can reduce
the
reproducer to:
select st_asflatgeobuf(row(1)) from pg_class;
AFAICT, inspect_table() doesn't check that a geometry column was indeed
found,
leading to the problem.
Some like that fixes the crash for me:
diff --git a/postgis/flatgeobuf.c b/postgis/flatgeobuf.c
index 1b502e546..545442f31 100644
--- a/postgis/flatgeobuf.c
+++ b/postgis/flatgeobuf.c
@@ -110,6 +110,9 @@ static void inspect_table(struct flatgeobuf_agg_ctx
*ctx)
columns_size++;
}
+ if (!geom_found)
+ elog(ERROR, "no geom column found");
+
if (columns_size > 0) {
ctx->ctx->columns = columns;
ctx->ctx->columns_size = columns_size;
}}}
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5173>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list