#4331 closed defect (fixed)
ST_3DMakeBox crashes on POINT EMPTY
Reported by: | robe | Owned by: | pramsey |
---|---|---|---|
Priority: | blocker | Milestone: | PostGIS 3.0.0 |
Component: | postgis | Version: | 2.4.x |
Keywords: | Cc: |
Description
Tested on
POSTGIS="3.0.0dev r17279" [EXTENSION] PGSQL="120" GEOS="3.8.0dev-CAPI-1.11.0 a47cf0f5" SFCGAL="1.3.2" PROJ="Rel. 5.2.0, September 15th, 2018" GDAL="GDAL 2.3.1, released 2018/06/22" LIBXML="2.7.8" LIBPROTOBUF="1.2.1" RASTER PostgreSQL 12develslicing on x86_64-w64-mingw32, compiled by gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0, 64-bit
and
POSTGIS="3.0.0dev r17265" [EXTENSION] PGSQL="110" GEOS="3.8.0dev-CAPI-1.11.0 a47cf0f5" PROJ="Rel. 5.2.0, September 15th, 2018" LIBXML="2.7.8" LIBPROTOBUF="1.2.1" PostgreSQL 11.0 on x86_64-w64-mingw32, compiled by gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0, 64-bit
SELECT ST_3DMakeBox(ST_GeomFromText('POINT EMPTY',4326), ST_GeomFromText('POINT EMPTY',4326))
I couldn't get a back trace for some reason. Just gives:
[Thread 9816.0x99c exited with code 0] [Thread 9816.0x3090 exited with code 3] [Thread 9816.0xd1c exited with code 3] [Inferior 1 (process 9816) exited with code 03]
PostGIS 2.5.1 is fine and gives:
BOX3D(0 2.61511713111389e-317 5.59388634019276e-317,5.59390215029343e-317 3.47323850655278e-317 5.59386657756693e-317)
I think i had run garden tests earlier in 3.0 cycle so this might be a relatively new issue in 3.0. Last time I tried running the tests I think a month or so it would hange becasue of thge GEOS 3.8 issue I was having under mingw64.
Change History (7)
comment:1 by , 6 years ago
comment:2 by , 6 years ago
This works fine in 12593.f4cdc57bc
and crashes in 12604.b608efe32
:
#0 0x00007f36f88fcd7f in raise () from /usr/lib/libc.so.6 #1 0x00007f36f88e7672 in abort () from /usr/lib/libc.so.6 #2 0x00007f36f88e7548 in __assert_fail_base.cold.0 () from /usr/lib/libc.so.6 #3 0x00007f36f88f5396 in __assert_fail () from /usr/lib/libc.so.6 #4 0x00007f34e8095e8e in getPoint3dz_p (pa=<optimized out>, n=0, op=<optimized out>) at /usr/src/debug/postgis/liblwgeom/lwgeom_api.c:222 #5 BOX3D_construct (fcinfo=<optimized out>) at lwgeom_box3d.c:570 #6 0x000055e6cf6523e0 in ExecInterpExpr (state=<optimized out>, econtext=<optimized out>, isnull=0x7ffe49cff5df) at execExprInterp.c:678 #7 0x000055e6cf71e5ae in ExecEvalExprSwitchContext (state=<optimized out>, econtext=0x7ffe49cff1c0, isNull=0x50e7494944bc0000) at ../../../../src/include/executor/executor.h:303 #8 evaluate_expr (expr=<optimized out>, result_type=85661, result_typmod=-1, result_collation=0) at clauses.c:4970 #9 0x000055e6cf71dddf in evaluate_function (funcid=85900, result_type=<optimized out>, result_typmod=-1, result_collid=0, input_collid=0, args=0x55e6d13d9408, context=<optimized out>, funcvariadic=<optimized out>, func_tuple=<optimized out>)
I can bisect it to a specific commit if necessary
comment:3 by , 6 years ago
It's this assert I left when debugging 3D intersection:
We can blindly pull out this assert, or we can do something to make the out-of-bounds access not happen in EMPTY. Does a 3DMakeBox make sense on top of two empty points? What is really expected in this case?
comment:4 by , 6 years ago
Does a 3DMakeBox make sense on top of two empty points? What is really expected in this case?
ST_MakeBox2D
returns an error (which isn't very clear BTW), so I'd match that behaviour:
SELECT ST_MakeBox2D(ST_GeomFromText('POINT EMPTY',4326), ST_GeomFromText('POINT EMPTY',4326)) ; ERROR: lwpoint_get_x called with empty geometry
comment:5 by , 6 years ago
Nothing makes sense on top of 2 empty points. Yah I'd go with just throwing an error. It makes more sense to make a box from a real point and a real linestring than it does to do so with 2 point empties and those return errors, so this should too.
Well at least the 2d does tell you you gave it a point empty which is clear to me.
posted case to Travis, let's see if it brings back a trace: https://github.com/postgis/postgis/pull/376