Opened 3 years ago

Closed 3 years ago

#4918 closed defect (fixed)

st_minpossiblevalue() causes crash

Reported by: Robins Owned by: robe
Priority: blocker Milestone: PostGIS 3.0.4
Component: raster Version: 3.0.x
Keywords: st_minpossiblevalue Cc:

Description

Passing empty string to st_minpossiblevalue() crashes server

regression=> select st_minpossiblevalue('');
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!?> \q

Change History (15)

comment:1 by pramsey, 3 years ago

Milestone: PostGIS 3.1.23.1.3

comment:2 by pramsey, 3 years ago

Milestone: 3.1.3PostGIS 3.1.3

Milestone renamed

comment:3 by Algunenano, 3 years ago

Component: postgisraster
Owner: changed from pramsey to robe

comment:4 by robe, 3 years ago

Milestone: PostGIS 3.1.3PostGIS 3.1.4

In prep for 3.1.3 release

comment:5 by robe, 3 years ago

Milestone: PostGIS 3.1.4PostGIS 3.0.4

This does not appear to be an issue with latest 3.1.2 or 3.1.3

Doing this:

SELECT ST_MinPossibleValue('');

I get the expected ERROR: RASTER_minPossibleValue: Invalid pixel type:

So I'm guessing this might not be an issue. I have put a test in place for it though and will backport the test to 3.0.4 to make sure.

comment:6 by Regina Obe <lr@…>, 3 years ago

In fd0cef4a/git:

Add test for ST_MinPossibleValue references #4918 for PostGIS 3.1.3

comment:7 by Regina Obe <lr@…>, 3 years ago

In 7de3ba7/git:

Add test for ST_MinPossibleValue references #4918 for PostGIS 3.2.0

comment:8 by Regina Obe <lr@…>, 3 years ago

In a967f9d/git:

Add test for ST_MinPossibleValue references #4918 for PostGIS 3.0.4

comment:9 by robe, 3 years ago

Resolution: worksforme
Status: newclosed

The 3.1 and 3.2 passed this test. I'm going to close now and reopen if 3.0.4 fails.

comment:10 by robe, 3 years ago

Priority: mediumblocker
Resolution: worksforme
Status: closedreopened

Okay the tests confirm 3.2 (main) and 3.1 branches are fine, but 3.0 branch does indeed crash.

14:26:36 -----------------------------------------------------------------------------
14:26:36 --- rt_utility_expected	2021-07-02 18:03:45.287954088 +0000
14:26:36 +++ /var/lib/jenkins/workspace/postgis/tmp/3_0_pg10w64/test_45_out	2021-07-02 18:26:36.149180741 +0000
14:26:36 @@ -31,31 +31,7 @@
14:26:36  test 11.9|t
14:26:36  test 11.10|t
14:26:36  test 11.11|t
14:26:36 -ERROR:  RASTER_minPossibleValue: Invalid pixel type: 
14:26:36 -Raster of 10x10 pixels has 3 bands and extent of BOX(0 -10,10 0)
14:26:36 -    band 1 of pixtype 8BUI is in-db with NODATA value of 0
14:26:36 -    band 2 of pixtype 32BF is in-db with NODATA value of -9999
14:26:36 -    band 3 of pixtype 16BSI is in-db with no NODATA value
14:26:36 -Skewed raster of 10x10 pixels has 1 band and extent of BOX(0 -10,10 0.0001)
14:26:36 -    band 1 of pixtype 8BUI is in-db with NODATA value of 0
14:26:36 -1|Raster of 90x50 pixels has 3 bands and extent of BOX(0 -50,90 0)
14:26:36 -    band 1 of pixtype 8BUI is out-db with no NODATA value
14:26:36 -    band 2 of pixtype 8BUI is out-db with no NODATA value
14:26:36 -    band 3 of pixtype 8BUI is out-db with no NODATA value
14:26:36 -2|Raster of 90x50 pixels has 3 bands and extent of BOX(0 -50,90 0)
14:26:36 -    band 1 of pixtype 8BUI is out-db with no NODATA value
14:26:36 -    band 2 of pixtype 8BUI is out-db with no NODATA value
14:26:36 -    band 3 of pixtype 8BUI is out-db with no NODATA value
14:26:36 -3|Raster of 90x50 pixels has 2 bands and extent of BOX(0 -50,90 0)
14:26:36 -    band 1 of pixtype 8BUI is in-db with NODATA value of 0
14:26:36 -    band 2 of pixtype 8BUI is out-db with no NODATA value
14:26:36 -4|Raster of 90x50 pixels has 2 bands and extent of BOX(0 -50,90 0)
14:26:36 -    band 1 of pixtype 8BUI is out-db with NODATA value of 255
14:26:36 -    band 2 of pixtype 8BUI is in-db with NODATA value of 0
14:26:36 -ms1|64
14:26:36 -NOTICE:  Could not find raster band of index 1 when getting band path. Returning NULL
14:26:36 -bandpath1|
14:26:36 -bandpath2|testraster.tif
14:26:36 -bandpath2|testraster.tif
14:26:36 -bandpath2|
14:26:36 -bandpath2|testraster.tif
14:26:36 +server closed the connection unexpectedly
14:26:36 +	This probably means the server terminated abnormally
14:26:36 +	before or while processing the request.
14:26:36 +connection to server was lost
14:26:36 -----------------------------------------------------------------------------

comment:11 by robe, 3 years ago

Hmm I see github actions also crashed so back to having to fix this in 3.1 and 3.2. Not sure why it didn't crash on all.

I looked at the code too and didn't see much of a difference between 3.1 and 3.0

comment:12 by Paul Ramsey <pramsey@…>, 3 years ago

In a4d9beb/git:

Fix rare crash in st_minpossiblevalue(), references #4918

comment:13 by strk, 3 years ago

The problem is in an assertion in rt_pixtype_index_from_name which fail if the string is empty. The build in branches after 3.0 are with -DNDEBUG which prevents the assert from running

comment:14 by Paul Ramsey <pramsey@…>, 3 years ago

In 9395db4/git:

Fix rare crash in st_minpossiblevalue, references #4918

comment:15 by pramsey, 3 years ago

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.