File workaround-gcc7-crash.patch of Package libqt5-qtwebkit
From: Fabian Vogt <fabian@ritter-vogt.de>
Subject: Workaround crash in WTF::StringImpl::copyChars with GCC7
Undefined behaviour, see also https://github.com/annulen/webkit/issues/562
and https://bugs.webkit.org/show_bug.cgi?id=173407
Index: qtwebkit-opensource-src-5.9.0/Source/WTF/wtf/text/StringImpl.h
===================================================================
--- qtwebkit-opensource-src-5.9.0.orig/Source/WTF/wtf/text/StringImpl.h
+++ qtwebkit-opensource-src-5.9.0/Source/WTF/wtf/text/StringImpl.h
@@ -630,24 +630,7 @@ public:
return;
}
- if (numCharacters <= s_copyCharsInlineCutOff) {
- unsigned i = 0;
-#if (CPU(X86) || CPU(X86_64))
- const unsigned charsPerInt = sizeof(uint32_t) / sizeof(T);
-
- if (numCharacters > charsPerInt) {
- unsigned stopCount = numCharacters & ~(charsPerInt - 1);
-
- const uint32_t* srcCharacters = reinterpret_cast<const uint32_t*>(source);
- uint32_t* destCharacters = reinterpret_cast<uint32_t*>(destination);
- for (unsigned j = 0; i < stopCount; i += charsPerInt, ++j)
- destCharacters[j] = srcCharacters[j];
- }
-#endif
- for (; i < numCharacters; ++i)
- destination[i] = source[i];
- } else
- memcpy(destination, source, numCharacters * sizeof(T));
+ memcpy(destination, source, numCharacters * sizeof(T));
}
ALWAYS_INLINE static void copyChars(UChar* destination, const LChar* source, unsigned numCharacters)