[postgis-devel] st_asflatgeobuf detoast crash
Regina Obe
lr at pcorp.us
Sat Jun 18 16:52:53 PDT 2022
Thanks. Ticketed at
https://trac.osgeo.org/postgis/ticket/517
> -----Original Message-----
> From: postgis-devel [mailto:postgis-devel-bounces at lists.osgeo.org] On
Behalf
> Of Julien Rouhaud
> Sent: Saturday, June 18, 2022 11:41 AM
> To: PostGIS Development Discussion <postgis-devel at lists.osgeo.org>
> Subject: Re: [postgis-devel] st_asflatgeobuf detoast crash
>
> 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;
>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-devel
More information about the postgis-devel
mailing list