sct: qRound with param bigger than max int is undefined

oss-fuzz/399667098
This commit is contained in:
Albert Astals Cid
2025-03-03 21:51:03 +01:00
parent e98467d954
commit d0f2635e10
2 changed files with 13 additions and 4 deletions

View File

@ -60,4 +60,13 @@ inline QImage imageAlloc(qint32 width, qint32 height, const QImage::Format &form
return imageAlloc(QSize(width, height), format);
}
inline double qRoundOrZero(double d)
{
// If the value d is outside the range of int, the behavior is undefined.
if (d > std::numeric_limits<int>::max()) {
return 0;
}
return qRound(d);
}
#endif // UTIL_P_H