Opened 5 years ago

Closed 5 years ago

#4249 closed defect (fixed)

Undefined behaviour in test_raster_intersects

Reported by: Algunenano Owned by: Algunenano
Priority: medium Milestone: PostGIS 2.2.8
Component: raster Version: 2.2.x
Keywords: Cc:

Description

Looks line a division by zero:

Program terminated with signal SIGILL, Illegal instruction.
#0  0x0000557e97351799 in rt_raster_intersects_algorithm (rast1=0x557e97c6d810, rast2=0x557e97c6a130, band1=0x557e97cf00e0, 
    band2=0x557e97cdfac0, hasnodata1=1, hasnodata2=1, nodata1=0, nodata2=0) at rt_spatial_relationship.c:722
722             else if (FLT_EQ(((line1[Y2] - line1[Y1]) / (line1[X2] - line1[X1])), ((line2[Y2] - line2[Y1]) / (line2[X2] - line2[X1]))))
(gdb) p line1
$1 = {-1, -1, -1, 1}
(gdb) p line2
$2 = {0, 0, 2, 0}
(gdb) bt
#0  0x0000557e97351799 in rt_raster_intersects_algorithm (rast1=0x557e97c6d810, rast2=0x557e97c6a130, band1=0x557e97cf00e0, 
    band2=0x557e97cdfac0, hasnodata1=1, hasnodata2=1, nodata1=0, nodata2=0) at rt_spatial_relationship.c:722
#1  0x0000557e97350d23 in rt_raster_intersects (rast1=0x557e97c6d810, nband1=0, rast2=0x557e97c6a130, nband2=0, intersects=0x7fff86403344)
    at rt_spatial_relationship.c:1276
#2  0x0000557e97329e20 in test_raster_intersects () at cu_spatial_relationship.c:4323
#3  0x00007f27df460118 in ?? () from /usr/lib/libcunit.so.1
#4  0x00007f27df4603b2 in ?? () from /usr/lib/libcunit.so.1
#5  0x00007f27df4607b7 in CU_run_all_tests () from /usr/lib/libcunit.so.1
#6  0x0000557e97349865 in main (argc=1, argv=0x7fff864036c8) at cu_tester.c:103

Change History (6)

comment:1 by Algunenano, 5 years ago

Milestone: PostGIS 3.0.0PostGIS 2.2.8
Version: trunk2.2.x

WIP in https://github.com/postgis/postgis/pull/340

All supported releases affected

comment:2 by Raul Marin, 5 years ago

In 17039:

Fix undefined behaviour in raster intersection

References #4249

comment:3 by Raul Marin, 5 years ago

In 17040:

Fix undefined behaviour in raster intersection

References #4249

comment:4 by Raul Marin, 5 years ago

In 17041:

Fix undefined behaviour in raster intersection

References #4249

comment:5 by Raul Marin, 5 years ago

In 17042:

Fix undefined behaviour in raster intersection

References #4249

comment:6 by Raul Marin, 5 years ago

Resolution: fixed
Status: assignedclosed

In 17043:

Fix undefined behaviour in raster intersection

Closes #4249
Closes https://github.com/postgis/postgis/pull/340

Note: See TracTickets for help on using tickets.