Opened 6 years ago

Closed 6 years ago

#4188 closed defect (fixed)

Division by zero in kmeans

Reported by: Algunenano Owned by: Algunenano
Priority: medium Milestone: PostGIS 2.5.1
Component: postgis Version: 2.5.x -- EOL
Keywords: Cc:

Description

I'm getting a warning when running regress tests under clang's sanitizer (-fsanitize=undefined -fsanitize-trap=undefined):

                Stack trace of thread 26485:
                #0  0x00007f611e683c75 update_means (postgis-3.0.so)
                #1  0x00007f611e682c02 kmeans (postgis-3.0.so)
                #2  0x00007f611e6812c2 lwgeom_cluster_2d_kmeans (postgis-3.0.so)
                #3  0x00007f611e3e2837 ST_ClusterKMeans (postgis-3.0.so)
                #4  0x000055c82ba2e281 ExecWindowAgg (postgres)
                #5  0x000055c82ba100d6 fetch_input_tuple (postgres)
                #6  0x000055c82ba0eb37 ExecAgg (postgres)
                #7  0x000055c82b9fc70c standard_ExecutorRun (postgres)
                #8  0x000055c82bb7d8e3 PortalRunSelect (postgres)
                #9  0x000055c82bb7d444 PortalRun (postgres)
                #10 0x000055c82bb7c27c exec_simple_query (postgres

PR in https://github.com/postgis/postgis/pull/309

At least 2.5 and trunk are affected.

Change History (2)

comment:1 by algunenano, 6 years ago

In 16859:

Avoid division by zero in kmeans

References #4188

comment:2 by algunenano, 6 years ago

Resolution: fixed
Status: assignedclosed

In 16860:

Avoid division by zero in kmeans

Closes #4188
Closes https://github.com/postgis/postgis/pull/309

Note: See TracTickets for help on using tickets.