#3997 closed defect (fixed)
Division by zero in iterate_4d
Reported by: | Algunenano | Owned by: | strk |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.5.0 |
Component: | liblwgeom | Version: | master |
Keywords: | Cc: |
Description
There is a typo calculating distances in the z-axis.
It appeared as an error as a division by zero
lwgeom_median.c:111:17: runtime error: division by zero
in the test
do_median_test("MULTIPOINT ZM ((0 -1 0 1), (0 0 0 1), (0 1 0 0.5), (0 1 0 0.5))", "POINT (0 0 0)", LW_TRUE, 1000);
Github PR: https://github.com/postgis/postgis/pull/196
Change History (9)
comment:1 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 7 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Such fixes should come with a testcase. Can you please add one Raul? Or Komzpa ?
comment:3 by , 7 years ago
Working on it. It's really tricky you need a really specific geometry. Also the division by zero is still possible.
comment:4 by , 7 years ago
PR with the test and removing the possibility of division by zero: https://github.com/postgis/postgis/pull/198
comment:6 by , 7 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
As @komzpa commented in the GH issue (https://github.com/postgis/postgis/pull/198#issuecomment-362911760) the ticket introduced here is failing.
Here is the PR with the fix (basically change how the check is done, from comparing coordinates to comparing sum of distances): https://github.com/postgis/postgis/pull/205
comment:7 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Fixed with https://trac.osgeo.org/postgis/ticket/4012
In 16341: