From 3144f90d93c2b6209e3b8a65bb9655cc7c6ada79 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 8 Apr 2020 17:39:29 -0300 Subject: [PATCH] QString: mark qustrlen() as unsuitable for ASan We load an aligned 16-byte on the first load, even if 14 of the 16 bytes are before the string contents themselves. Pick-To: 5.15 Change-Id: Ibdc95e9af7bd456a94ecfffd1603f2b8c87655b1 Reviewed-by: Allan Sandfeld Jensen --- src/corelib/text/qstring.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 440369c674..348276810b 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -159,6 +159,11 @@ static inline bool qt_ends_with(QStringView haystack, QStringView needle, Qt::Ca static inline bool qt_ends_with(QStringView haystack, QLatin1String needle, Qt::CaseSensitivity cs); static inline bool qt_ends_with(QStringView haystack, QChar needle, Qt::CaseSensitivity cs); +#if defined(__SSE2__) && defined(Q_CC_GNU) && !defined(Q_CC_INTEL) +// We may overrun the buffer, but that's a false positive: +// this won't crash nor produce incorrect results +__attribute__((__no_sanitize_address__)) +#endif qsizetype QtPrivate::qustrlen(const ushort *str) noexcept { qsizetype result = 0;