mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2026-09-20 22:46:59 -04:00
sct: qRound with param bigger than max int is undefined
oss-fuzz/399667098
This commit is contained in:
committed by
Mirco Miranda
parent
5d2540c135
commit
b28baa4a1e
@@ -61,4 +61,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
|
||||
|
||||
Reference in New Issue
Block a user