IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41505 for trunk/psLib


Ignore:
Timestamp:
Feb 24, 2021, 10:32:22 AM (5 years ago)
Author:
eugene
Message:

add some asserts to catch out-of-range elements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/fits/psFitsScale.c

    r39926 r41505  
    987987    PS_ASSERT_FITS_NON_NULL(fits, NULL);
    988988
     989    // fprintf (stderr, "psFitsScaleForDisk : bscale  : %g\n", bscale);
     990    // fprintf (stderr, "psFitsScaleForDisk : bzero   : %g\n", bzero);
     991    // fprintf (stderr, "psFitsScaleForDisk : boffset : %g\n", boffset);
     992    // fprintf (stderr, "psFitsScaleForDisk : bsoften : %g\n", bsoften);
     993
    989994    psFitsOptions *options = fits->options; // FITS options
    990995    if (!PS_IS_PSELEMTYPE_REAL(image->type.type) || !options || options->bitpix == 0) {
     
    9951000    int bitpix = options->bitpix;       // Bits per pixel
    9961001    psElemType outType;                 // Type for output image
     1002
     1003    // fprintf (stderr, "psFitsScaleForDisk : bitpix : %d\n", bitpix);
     1004
    9971005    // Choosing to use signed types because those don't require BSCALE,BZERO to represent them in the FITS
    9981006    // file
     
    10811089                    /* Check for underflow and overflow; set either to max */ \
    10821090                    (OUT)->data.OUTTYPE[y][x] = (value < min || value > max ? max : floor(value)); \
     1091                    psAssert(x >= 0, "oops");                           \
     1092                    psAssert(y >= 0, "oops");                           \
     1093                    psAssert(x < numCols, "oops");                      \
     1094                    psAssert(y < numRows, "oops");                      \
    10831095                }                                                       \
    10841096            }                                                           \
Note: See TracChangeset for help on using the changeset viewer.