diff --git a/src/corelib/text/qtextboundaryfinder.cpp b/src/corelib/text/qtextboundaryfinder.cpp index e387df3f8d5..937f88b2525 100644 --- a/src/corelib/text/qtextboundaryfinder.cpp +++ b/src/corelib/text/qtextboundaryfinder.cpp @@ -213,7 +213,7 @@ QTextBoundaryFinder::QTextBoundaryFinder(BoundaryType type, QStringView string, , attributes(nullptr) { if (!sv.isEmpty()) { - if (buffer && (uint)bufferSize >= (sv.size() + 1) * sizeof(QCharAttributes)) { + if (buffer && bufferSize / int(sizeof(QCharAttributes)) >= sv.size() + 1) { attributes = reinterpret_cast(buffer); freeBuffer = false; } else {