Ticket #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 VizGeorefSpline?2D::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.
