diff --git a/gcore/overview.cpp b/gcore/overview.cpp index 8d1c4f3b2444..bd53d67fc73e 100644 --- a/gcore/overview.cpp +++ b/gcore/overview.cpp @@ -3142,7 +3142,10 @@ static CPLErr GDALResampleChunk_ConvolutionT( : dfNoDataValue; // cppcheck-suppress unreadVariable const int isIntegerDT = GDALDataTypeIsInteger(dstDataType); - const auto nNodataValueInt64 = static_cast(dfNoDataValue); + const auto nNodataValueInt64 = + isIntegerDT && GDALIsValueExactAs(dfNoDataValue) + ? static_cast(dfNoDataValue) + : 0; constexpr int nWrkDataTypeSize = static_cast(sizeof(Twork)); // TODO: we should have some generic function to do this.