Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12.10
-
None
Description
build qt with enabled ubsan.
Launch wayland compositor examples.
ubsan reports sub overflow in qrect.h on code:
Q_DECL_CONSTEXPR inline int QRect::width() const Q_DECL_NOTHROW { return x2 - x1 + 1; }
The reason of overflow is next code in file qwaylandsurface.cpp:
static QRegion infiniteRegion() { return QRegion(QRect(QPoint(std::numeric_limits<int>::min(), std::numeric_limits<int>::min()), QPoint(std::numeric_limits<int>::max(), std::numeric_limits<int>::max()))); }
as you can see, with()function will calculate
INT_MAX - INT_MIN +1;
this is real overflow.
I checked on master:
it is also has this issue.