Skip to content

Commit

Permalink
VRT: silence Coverity false positive (CID 1589208, 1589104, 1589098)
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Jan 12, 2025
1 parent 4cd50a2 commit a9d5505
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions frmts/vrt/pixelfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ static CPLErr DivPixelFunc(void **papoSources, int nSources, void *pData,
for (int iCol = 0; iCol < nXSize; ++iCol, ++ii)
{
const double dfVal = GetSrcVal(papoSources[1], eSrcType, ii);
// coverity[divide_by_zero]
double dfPixVal =
dfVal == 0
? std::numeric_limits<double>::infinity()
Expand Down Expand Up @@ -914,6 +915,7 @@ static CPLErr InvPixelFunc(void **papoSources, int nSources, void *pData,
// Source raster pixels may be obtained with GetSrcVal macro.
// Not complex.
const double dfVal = GetSrcVal(papoSources[0], eSrcType, ii);
// coverity[divide_by_zero]
const double dfPixVal =
dfVal == 0 ? std::numeric_limits<double>::infinity()
: dfK / dfVal;
Expand Down Expand Up @@ -1482,6 +1484,7 @@ static CPLErr NormDiffPixelFunc(void **papoSources, int nSources, void *pData,

const double dfDenom = (dfLeftVal + dfRightVal);

// coverity[divide_by_zero]
const double dfPixVal =
dfDenom == 0 ? std::numeric_limits<double>::infinity()
: (dfLeftVal - dfRightVal) / dfDenom;
Expand Down

0 comments on commit a9d5505

Please sign in to comment.