IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 5, 2009, 10:40:34 AM (17 years ago)
Author:
Paul Price
Message:

Fixing memory corruption bug.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/psImageCovariance.c

    r21316 r21322  
    192192    double threshold = (1.0 - frac) * sum; // Threshold for truncation
    193193    int maxRadius = PS_MAX(PS_MAX(PS_MAX(xMax, yMax), -xMin), yMin); // Maximum radius of covariance matrix
    194     double enclosed = NAN;              // Enclosed value
     194    double enclosed = 0.0;              // Enclosed value
    195195    int radius;                         // Radius at which to truncate
    196196    for (radius = 0; radius <= maxRadius && enclosed < threshold; radius++) {
     
    208208    int numBytes = (2 * radius + 1) * PSELEMTYPE_SIZEOF(PS_TYPE_F32); // Number of bytes to copy
    209209    for (int y = -radius; y <= radius; y++) {
    210         memcpy(trunc->kernel[y], covar->kernel[y], numBytes);
     210        memcpy(&trunc->kernel[y][-radius], &covar->kernel[y][-radius], numBytes);
    211211    }
    212212
Note: See TracChangeset for help on using the changeset viewer.