Opened 13 years ago

Closed 13 years ago

#1432 closed defect (fixed)

[RASTER] segfaults on regression testing with --enable-cassert

Reported by: strk Owned by: Bborie Park
Priority: critical Milestone: PostGIS 2.0.0
Component: raster Version: master
Keywords: Cc:

Description

Change History (11)

comment:1 by strk, 13 years ago

One failure is in rt_asgdalraster and particularly this call:

SELECT ST_AsGDALRaster(
 ST_AddBand(
  ST_AddBand(
   ST_AddBand(
    ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0),
    1, '8BSI', 1, -1
   ), 
   2, '8BSI', 11, -1
  ),
  3, '8BSI', 111, -1
 ),
 'PNG',
 ARRAY['ZLEVEL=1']
);

Dropping the ARRAY parameter fixes the segfault

comment:2 by strk, 13 years ago

Owner: changed from pracine to Bborie Park

What happens is that RASTER_asGDALRaster builds the "options" variable to be NULL terminated but trims the allocated array to the exact number of items thus de-allocating he terminating null.

r8674 fixes this case, but there are more. --enable-cassert is your friend Bborie !

comment:3 by strk, 13 years ago

Next is RT_BandMetadata, segfaulting on this:

SELECT 
        pixeltype,
        hasnodata,
        round(nodatavalue::numeric, 3),
        isoutdb,
        path
FROM ST_BandMetaData(
        make_test_raster(10, 10, 0, 0, 0, 0, 5, TRUE),
        6
);

Changing last arg to 5 prevents the crash

comment:4 by strk, 13 years ago

Resolution: fixed
Status: newclosed

This one is fixed by properly switching memory context back before exiting prematurely from the function. I've seen other such cases but the testsuite doesn't react with a segfault. See r8678

comment:5 by Bborie Park, 13 years ago

Resolution: fixed
Status: closedreopened

I'm reopening this as I'll be auditing all the other raster functions.

comment:6 by Bborie Park, 13 years ago

Status: reopenednew

Fixes for ST_Histogram, ST_Quantile, ST_Reclass, ST_SummaryStats and ST_ValueCount added in r8679.

comment:7 by robe, 13 years ago

Bborie,

I wonder if this will fix the crashing issue I was experiencing with my garden tests that you couldn't repelicate. That is almost always crashed on ST_reclass. I forgot that I don't test PostgreSQL on windows the normal way.

I use the zipped EDB builds and do not launch the instances as a service. So the EDB zipped builds may be a little different from the installer ones or the fact I launch them from a batch script rather than a service may also make a difference.

comment:8 by robe, 13 years ago

I'll give those tests a retry and close out that other ticket if this fixes it.

comment:9 by Bborie Park, 13 years ago

Regina,

That's the hope. It is absolutely plausible that the memory handling was causing crashes in your garden tests. I'm going to be auditing all the raster functions... hopefully have it done today and before you tag an alpha.

comment:10 by Bborie Park, 13 years ago

Status: newassigned

Added additional regression tests for ST_AsGDALRaster, ST_GDALDrivers, ST_AsRaster, ST_Resample, ST_Metadata in r8681.

comment:11 by Bborie Park, 13 years ago

Resolution: fixed
Status: assignedclosed

Last bit of code cleanup from auditing rt_pg.c in r8683.

Note: See TracTickets for help on using tickets.