mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2026-02-19 07:03:01 -05:00
sct: qRound with param bigger than max int is undefined
oss-fuzz/399667098
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user