[postgis-tickets] [PostGIS] #4247: Undefined behaviour in next_float_down / next_float_up

PostGIS trac at osgeo.org
Tue Nov 20 07:39:45 PST 2018


#4247: Undefined behaviour in next_float_down / next_float_up
------------------------+---------------------------
 Reporter:  Algunenano  |      Owner:  Algunenano
     Type:  defect      |     Status:  assigned
 Priority:  high        |  Milestone:  PostGIS 3.0.0
Component:  postgis     |    Version:  trunk
 Keywords:              |
------------------------+---------------------------
 When passing double bigger than FLT_MAX or smaller than -FLT_MAX the
 behaviour of the function is undefined.

 {{{
 #0  0x00007f8574dd1451 in next_float_down (d=-1.7976931348623157e+308) at
 lwgeom_api.c:53
 53              float result  = d;
 (gdb) bt
 #0  0x00007f8574dd1451 in next_float_down (d=-1.7976931348623157e+308) at
 lwgeom_api.c:53
 #1  0x00007f8574e9907d in gserialized_from_gbox (gbox=0x55f1780ae898,
     buf=0x55f1780ae930
 "\033y\202J\034y\202J\275\034}H\276\034}Hjx\245Dkx\245D") at
 g_serialized.c:1159
 #2  0x00007f8574e98288 in gserialized_from_lwgeom (geom=0x55f1780ae738,
 size=0x7ffda6b14c60) at g_serialized.c:1209
 #3  0x00007f8574d90fe7 in geometry_serialize (lwgeom=0x55f1780ae738) at
 lwgeom_pg.c:205
 #4  0x00007f8574c04cef in LWGEOM_in (fcinfo=0x7ffda6b14e08) at
 lwgeom_inout.c:140
 }}}

 {{{
 Using host libthread_db library "/usr/lib/libthread_db.so.1".
 Core was generated by `postgres: raul postgis_reg [local] SELECT  '.
 Program terminated with signal SIGILL, Illegal instruction.
 #0  0x00007f8574dd1551 in next_float_up (d=-1.7976931348623157e+308) at
 lwgeom_api.c:71
 71              float result  = d;
 (gdb) q
 }}}

 This might have an effect when serializing geometries.

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