[postgis-tickets] [PostGIS] #4722: crash on null input to topogeo_addpoint()

PostGIS trac at osgeo.org
Wed Jul 15 04:20:25 PDT 2020


#4722: crash on null input to topogeo_addpoint()
------------------------------+---------------------------
 Reporter:  Robins            |      Owner:  strk
     Type:  defect            |     Status:  new
 Priority:  medium            |  Milestone:  PostGIS 3.1.0
Component:  topology          |    Version:  3.0.x
 Keywords:  topogeo_addpoint  |
------------------------------+---------------------------
 When topogeo_addpoint() is called with NULLs it crashes the server.

 Sample SQLs:
 {{{

 SELECT topogeo_addpoint(null::varchar, null::geometry, NULL::float8);
 SELECT topogeo_addpoint(cast(null as "varchar"),cast(null as
 geometry),cast(NULL as float8));

 }}}



 ----


 SQL Output
 {{{
 db=> SELECT postgis_full_version();
 postgis_full_version

 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 -----------
  POSTGIS="3.0.0 r17983" [EXTENSION] PGSQL="120" GEOS="3.8.0-CAPI-1.13.1 "
 PROJ="Rel. 5.2.0, September 15th, 2018" LIBXML="2.9.1" LIBJSON="0.13.1"
 LIBPROTOBUF="1.3.2" WAGYU="0.4.3 (Internal)" TOPOLOGY
 (1 row)

 db=> select version();
                                                  version
 ---------------------------------------------------------------------------------------------------------
  PostgreSQL 12.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5
 20150623 (Red Hat 4.8.5-11), 64-bit
 (1 row)

 db=> \dx
                                          List of installed extensions
        Name       | Version |   Schema   |
 Description
 ------------------+---------+------------+---------------------------------------------------------------------
  plpgsql          | 1.0     | pg_catalog | PL/pgSQL procedural language
  postgis          | 3.0.0   | public     | PostGIS geometry, geography,
 and raster spatial types and functions
  postgis_topology | 3.0.0   | topology   | PostGIS topology spatial types
 and functions
 (3 rows)

 db=> SELECT topogeo_addpoint(cast(null as "varchar"),cast(null as
 geometry),cast(NULL as float8));
 server closed the connection unexpectedly
         This probably means the server terminated abnormally
         before or while processing the request.
 The connection to the server was lost. Attempting reset: Failed.
 !?> \q
 ~$ psql db
 psql (13beta2, server 12.3)
 Type "help" for help.

 db=>

 }}}


 ----
 Error Logs

 {{{
 2020-07-15 02:35:32 UTC::@:[23172]:LOG:  server process (PID 27631) was
 terminated by signal 11: Segmentation fault
 2020-07-15 02:35:32 UTC::@:[23172]:DETAIL:  Failed process was running:
 SELECT topogeo_addpoint(cast(null as "varchar"),cast(null as
 geometry),cast(NULL as float8));
 2020-07-15 02:35:32 UTC::@:[23172]:LOG:  terminating any other active
 server processes
 2020-07-15 02:35:32 UTC::@:[26751]:WARNING:  terminating connection
 because of crash of another server process
 2020-07-15 02:35:32 UTC::@:[26751]:DETAIL:  The postmaster has commanded
 this server process to roll back the current transaction and exit, because
 another server process exited abnormally and possibly corrupted shared
 memory.
 2020-07-15 02:35:32 UTC::@:[26751]:HINT:  In a moment you should be able
 to reconnect to the database and repeat your command.
 2020-07-15 02:35:32 UTC::@:[23172]:LOG:  archiver process (PID 26752)
 exited with exit code 1
 2020-07-15 02:35:32 UTC:172.31.7.235(45906):postgres123 at db:[28053]:FATAL:
 the database system is in recovery mode
 2020-07-15 02:35:32 UTC::@:[23172]:LOG:  all server processes terminated;
 reinitializing
 2020-07-15 02:35:32 UTC::@:[28054]:LOG:  database system was interrupted;
 last known up at 2020-07-15 02:33:29 UTC
 2020-07-15 02:35:32 UTC::@:[28054]:LOG:  database system was not properly
 shut down; automatic recovery in progress
 2020-07-15 02:35:32 UTC::@:[28054]:LOG:  redo starts at 36/55478720
 2020-07-15 02:35:32 UTC::@:[28054]:LOG:  invalid record length at
 36/554E6F18: wanted 24, got 0
 2020-07-15 02:35:32 UTC::@:[28054]:LOG:  redo done at 36/554E5170
 2020-07-15 02:35:32 UTC::@:[28054]:LOG:  checkpoint starting: end-of-
 recovery immediate
 2020-07-15 02:35:32 UTC::@:[28054]:LOG:  checkpoint complete: wrote 62
 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.003 s,
 sync=0.002 s, total=0.015 s; sync files=13, longest=0.002 s, average=0.000
 s; distance=442 kB, estimate=442 kB
 2020-07-15 02:35:32 UTC::@:[23172]:LOG:  database system is ready to
 accept connections

 }}}

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4722>
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