blob: baf062fe7d9e5d0343996ddb296ca583cad45813 [file] [log] [blame]
diff --git a/Source/WebCore/accessibility/AXObjectCache.cpp b/Source/WebCore/accessibility/AXObjectCache.cpp
index 3998f313e0f6..31b8a2b78c32 100644
--- a/Source/WebCore/accessibility/AXObjectCache.cpp
+++ b/Source/WebCore/accessibility/AXObjectCache.cpp
@@ -1707,7 +1707,9 @@ CharacterOffset AXObjectCache::startOrEndCharacterOffsetForRange(RefPtr<Range> r
void AXObjectCache::startOrEndTextMarkerDataForRange(TextMarkerData& textMarkerData, RefPtr<Range> range, bool isStart)
{
- memset(&textMarkerData, 0, sizeof(TextMarkerData));
+ // This memory must be zero'd so instances of TextMarkerData can be tested for byte-equivalence.
+ // Warning: This is risky and bad because TextMarkerData is a nontrivial type.
+ memset(static_cast<void*>(&textMarkerData), 0, sizeof(TextMarkerData));
CharacterOffset characterOffset = startOrEndCharacterOffsetForRange(range, isStart);
if (characterOffset.isNull())
@@ -1766,7 +1766,10 @@ CharacterOffset AXObjectCache::characterOffsetForNodeAndOffset(Node& node, int o
void AXObjectCache::textMarkerDataForCharacterOffset(TextMarkerData& textMarkerData, const CharacterOffset& characterOffset)
{
- memset(&textMarkerData, 0, sizeof(TextMarkerData));
+ // This memory must be zero'd so instances of TextMarkerData can be tested for byte-equivalence.
+ // Warning: This is risky and bad because TextMarkerData is a nontrivial type.
+ memset(static_cast<void*>(&textMarkerData), 0, sizeof(TextMarkerData));
+
setTextMarkerDataWithCharacterOffset(textMarkerData, characterOffset);
}
@@ -1877,7 +1877,8 @@ std::optional<TextMarkerData> AXObjectCache::textMarkerDataForVisiblePosition(co
{
// This memory must be bzero'd so instances of TextMarkerData can be tested for byte-equivalence.
// This also allows callers to check for failure by looking at textMarkerData upon return.
- memset(&textMarkerData, 0, sizeof(TextMarkerData));
+ // Warning: This is risky and bad because TextMarkerData is a nontrivial type.
+ memset(static_cast<void*>(&textMarkerData), 0, sizeof(TextMarkerData));
if (visiblePos.isNull())
return;
diff --git a/Source/WebCore/css/CSSSelectorList.cpp b/Source/WebCore/css/CSSSelectorList.cpp
index 57efa67d0b3e..4fc69838c710 100644
--- a/Source/WebCore/css/CSSSelectorList.cpp
+++ b/Source/WebCore/css/CSSSelectorList.cpp
@@ -67,7 +67,7 @@ void CSSSelectorList::adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelect
{
// Move item from the parser selector vector into m_selectorArray without invoking destructor (Ugh.)
CSSSelector* currentSelector = current->releaseSelector().release();
- memcpy(&m_selectorArray[arrayIndex], currentSelector, sizeof(CSSSelector));
+ memcpy(static_cast<void*>(&m_selectorArray[arrayIndex]), static_cast<void*>(currentSelector), sizeof(CSSSelector));
// Free the underlying memory without invoking the destructor.
operator delete (currentSelector);
diff --git a/Source/WebCore/platform/graphics/Gradient.cpp b/Source/WebCore/platform/graphics/Gradient.cpp
index e7f8c6710153..8994c021edfb 100644
--- a/Source/WebCore/platform/graphics/Gradient.cpp
+++ b/Source/WebCore/platform/graphics/Gradient.cpp
@@ -213,7 +213,8 @@ unsigned Gradient::hash() const
COMPILE_ASSERT(!(sizeof(ColorStop) % 2), Color_stop_size_should_be_multiple_of_two);
// Ensure that any padding in the struct is zero-filled, so it will not affect the hash value.
- memset(&parameters, 0, sizeof(parameters));
+ // FIXME: This is asking for trouble, because it is a nontrivial type.
+ memset(static_cast<void*>(&parameters), 0, sizeof(parameters));
WTF::switchOn(m_data,
[&parameters] (const LinearData& data) {
diff --git a/Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp b/Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp
index d3fc934fe4be..bd9cd0009afb 100644
--- a/Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp
+++ b/Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp
@@ -48,7 +48,7 @@ FontCustomPlatformData::FontCustomPlatformData(FT_Face freeTypeFace, SharedBuffe
// this cairo_font_face_t is destroyed, it cleans up the FreeType face as well.
static cairo_user_data_key_t freeTypeFaceKey;
cairo_font_face_set_user_data(m_fontFace, &freeTypeFaceKey, freeTypeFace,
- reinterpret_cast<cairo_destroy_func_t>(FT_Done_Face));
+ reinterpret_cast<cairo_destroy_func_t>(reinterpret_cast<GCallback>(FT_Done_Face)));
}
FontCustomPlatformData::~FontCustomPlatformData()
diff -Naur qtwebkit-5.212.0-alpha3-orig/Source/JavaScriptCore/b3/B3ValueRep.h qtwebkit-5.212.0-alpha3/Source/JavaScriptCore/b3/B3ValueRep.h
--- qtwebkit-5.212.0-alpha3-orig/Source/JavaScriptCore/b3/B3ValueRep.h 2019-06-26 19:25:02.000000000 +0300
+++ qtwebkit-5.212.0-alpha3/Source/JavaScriptCore/b3/B3ValueRep.h 2019-07-16 09:45:00.192287500 +0300
@@ -256,7 +256,7 @@
U()
{
- memset(this, 0, sizeof(*this));
+ memset(static_cast<void*>(this), 0, sizeof(*this));
}
} u;
};
diff -Naur qtwebkit-5.212.0-alpha3-orig/Source/WTF/wtf/StackBounds.cpp qtwebkit-5.212.0-alpha3/Source/WTF/wtf/StackBounds.cpp
--- qtwebkit-5.212.0-alpha3-orig/Source/WTF/wtf/StackBounds.cpp 2019-06-26 19:25:02.000000000 +0300
+++ qtwebkit-5.212.0-alpha3/Source/WTF/wtf/StackBounds.cpp 2019-07-16 09:45:00.239087600 +0300
@@ -119,7 +119,7 @@
void StackBounds::initialize()
{
- MEMORY_BASIC_INFORMATION stackOrigin = { 0 };
+ MEMORY_BASIC_INFORMATION stackOrigin { };
VirtualQuery(&stackOrigin, &stackOrigin, sizeof(stackOrigin));
// stackOrigin.AllocationBase points to the reserved stack memory base address.