Skip to content

Commit

Permalink
GDALResampleChunk_ConvolutionT(): avoid casting NaN to int64_t
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Mar 3, 2025
1 parent 7ced0d6 commit 9b522d1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gcore/overview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3142,7 +3142,10 @@ static CPLErr GDALResampleChunk_ConvolutionT(
: dfNoDataValue;
// cppcheck-suppress unreadVariable
const int isIntegerDT = GDALDataTypeIsInteger(dstDataType);
const auto nNodataValueInt64 = static_cast<GInt64>(dfNoDataValue);
const auto nNodataValueInt64 =
isIntegerDT && GDALIsValueExactAs<GInt64>(dfNoDataValue)
? static_cast<GInt64>(dfNoDataValue)
: 0;
constexpr int nWrkDataTypeSize = static_cast<int>(sizeof(Twork));

// TODO: we should have some generic function to do this.
Expand Down

0 comments on commit 9b522d1

Please sign in to comment.