IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 25, 2021, 5:04:15 PM (5 years ago)
Author:
eugene
Message:

add some asserts to trap memory overflow

Location:
branches/eam_branches/ipp-dev-20210817/psModules/src/detrend
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-dev-20210817/psModules/src/detrend/pmPattern.c

    r41859 r41861  
    418418          for (int x = 0; x < numCols; x++) {
    419419            image->data.F32[y][x] += solution->data.F32[y];
    420             psTrace("pattern",5,"B: %d %d %g\n",x,y,solution->data.F32[x]);
     420            psTrace("pattern",5,"B: %d %d %g\n",x,y,solution->data.F32[y]);
    421421          }
    422422          corr->data.F64[y][0]  -= solution->data.F32[y];
     
    444444          for (int x = 0; x < numCols; x++) {
    445445            image->data.F32[y][x] += solution->data.F32[y] * indices->data.F32[x];
    446             psTrace("pattern",5,"C: %d %d %g %g\n",x,y,solution->data.F32[x],indices->data.F32[x]);
     446            // XXX EAM : this was [x] which is wrong
     447            psTrace("pattern",5,"C: %d %d %g %g\n",x,y,solution->data.F32[y],indices->data.F32[x]);
    447448          }
    448449          corr->data.F64[y][1]  -= solution->data.F32[y] ;
     
    703704        }
    704705
     706        psAssert (solution->n == numCols, "oops");
    705707        for (int x = 0; x < numCols; x++) {
    706708            image->data.F32[y][x] -= solution->data.F32[x];
     
    747749        }
    748750      } else {
     751        psAssert (solution->n == numRows, "oops");
    749752        for (int y = 0; y < numRows; y++) {
    750753          for (int x = 0; x < numCols; x++) {
    751754            image->data.F32[y][x] += solution->data.F32[y];
    752             psTrace("pattern",5,"B: %d %d %g\n",x,y,solution->data.F32[x]);
     755            // XXX EAM : this was [x], which is wrong
     756            psTrace("pattern",5,"B: %d %d %g\n",x,y,solution->data.F32[y]);
    753757          }
    754758          corr->data.F64[y][0]  -= solution->data.F32[y];
     
    771775        psErrorClear();
    772776      } else {
     777        psAssert (solution->n == numRows, "oops");
    773778        for (int y = 0; y < numRows; y++) {
    774779          for (int x = 0; x < numCols; x++) {
    775780            image->data.F32[y][x] += solution->data.F32[y] * indices->data.F32[x];
    776             psTrace("pattern",5,"C: %d %d %g %g\n",x,y,solution->data.F32[x],indices->data.F32[x]);
     781            // XXX EAM : this was set to [x] which is wrong (numCols > numRows)
     782            psTrace("pattern",5,"C: %d %d %g %g\n",x,y,solution->data.F32[y],indices->data.F32[x]);
    777783          }
    778784          corr->data.F64[y][1]  -= solution->data.F32[y] ;
  • branches/eam_branches/ipp-dev-20210817/psModules/src/detrend/pmPatternIO.c

    r41856 r41861  
    531531        for (int i = 0; i < model->n; i++) {
    532532            psMetadata *row = model->data[i];
     533            psAssert (row, "missing model row");
    533534
    534535            char *cellName = psMetadataLookupStr(&status, row, "CELL_NAME");
     
    538539
    539540            int cellNumber = pmChipFindCell (chip, cellName);
     541            psAssert ((cellNumber >=0) && (cellNumber < chip->cells->n), "invalid cell number");
     542
    540543            pmCell *cell = chip->cells->data[cellNumber];
    541544            if (!cell) continue;
     545
     546            psAssert (cell->analysis, "oops");
    542547
    543548            psMetadataAddF32 (cell->analysis, PS_LIST_TAIL, "PTN.ROW.AMP", PS_META_REPLACE, "", amplitude);
Note: See TracChangeset for help on using the changeset viewer.