Changeset 262242 in webkit
- Timestamp:
- May 28, 2020, 8:28:26 AM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
Shared/glib/ArgumentCodersGLib.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r262240 r262242 1 2020-05-28 Michael Catanzaro <mcatanzaro@gnome.org> 2 3 [WPE][GTK] GVariant decoding must copy the serialized data 4 https://bugs.webkit.org/show_bug.cgi?id=212441 5 6 Reviewed by Carlos Garcia Campos. 7 8 I tracked this down to ArgumentCodersGLib.cpp. The problem is that we construct a GVariant 9 using g_variant_new_from_data(), which does not copy or take ownership of the data, so here 10 we accidentally create the GVariant using data we don't own. (Here, the data is owned by the 11 Decoder itself in its internal m_buffer.) Anyway, this is fixable by manually copying and 12 freeing it with the GDestroyNotify parameter, but it's easier to switch to 13 g_variant_new_from_bytes() because GBytes takes ownership when constructed. 14 15 * Shared/glib/ArgumentCodersGLib.cpp: 16 (IPC::decode): 17 1 18 2020-05-28 Youenn Fablet <youenn@apple.com> 2 19 -
trunk/Source/WebKit/Shared/glib/ArgumentCodersGLib.cpp
r251181 r262242 29 29 #include "DataReference.h" 30 30 #include <glib.h> 31 #include <wtf/glib/GUniquePtr.h> 31 32 #include <wtf/text/CString.h> 32 33 … … 60 61 return WTF::nullopt; 61 62 62 auto* variantType = g_variant_type_new(variantTypeString.data()); 63 GRefPtr<GVariant> variant = g_variant_new_from_data(variantType, data.data(), data.size(), FALSE, nullptr, nullptr); 64 g_variant_type_free(variantType); 65 return variant; 63 GUniquePtr<GVariantType> variantType(g_variant_type_new(variantTypeString.data())); 64 GRefPtr<GBytes> bytes = adoptGRef(g_bytes_new(data.data(), data.size())); 65 return g_variant_new_from_bytes(variantType.get(), bytes.get(), FALSE); 66 66 } 67 67
Note:
See TracChangeset
for help on using the changeset viewer.