Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#2300 closed defect (fixed)

Thin Plate Spline Initialization Error

Reported by: warmerdam Owned by: warmerdam
Priority: high Milestone: 1.4.5
Component: GDAL_Raster Version: svn-trunk
Severity: major Keywords: tps thinplatespline
Cc:

Description

In some circumstances I was getting erroneous results from the gdaltransform commandline program when using the thin plate spline algorithm. Review with valgrind indicated use of uninitialized values which I traced to rhs[0][2] in alg/thinplatespline.cpp.

A careful review of the lifespan of rhs[] seems to indicate that values rhs[][0-2] are never actually set, but are used when evaluating equations.

A modification to VizGeorefSpline2D::grow_points() to initialize these values to zero seemed to correct the results and fix the uninitialized memory error. I *suspect* that rhs used to be guaranteed initialized to zero (perhaps using new) but this was lost in the conversion to use VSIMalloc(). I have not tried to confirm this with a deeper analysis.

I *suspect* this is at the core of our very unreliable thin plate spline results.

Change History (2)

comment:1 Changed 12 years ago by warmerdam

Priority: normalhigh
Resolution: fixed
Severity: normalmajor
Status: newclosed

Patch applied in trunk (r14117), 1.5 (r14118) and 1.4 (r14119) branches.

I'm closing, but comments indicating if this resolves older TPS stability problems would be appreciated.

comment:2 Changed 11 years ago by hamish

This seems to have had a positive effect on bug #864.

i.e. I get segfaults with gdalwarp 1.5.0, but not with the latest SVN/trunk.

hooray!

thanks, Hamish

Note: See TracTickets for help on using tickets.