<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Variant can crash when constructed with default constructor"
href="https://bugs.webkit.org/show_bug.cgi?id=165568">165568</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Variant can crash when constructed with default constructor
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>Product</th>
<td>WebKit
</td>
</tr>
<tr>
<th>Version</th>
<td>WebKit Nightly Build
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>OS</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>Normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P2
</td>
</tr>
<tr>
<th>Component</th>
<td>Web Template Framework
</td>
</tr>
<tr>
<th>Assignee</th>
<td>webkit-unassigned@lists.webkit.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>krollin@apple.com
</td>
</tr>
<tr>
<th>CC</th>
<td>krollin@apple.com, sam@webkit.org
</td>
</tr></table>
<p>
<div>
<pre>Given the following struct:
struct MyStruct {
MyStruct(Vector<String> val) : m_vector(val) {}
Vector<String> m_vector;
};
The following will crash in the WTF::Variant destructor:
{
WTF::Variant<MyStruct> temp;
}
Here's the backtrace:
0 WTF::RefPtr<WTF::StringImpl>::~RefPtr() + 67 (utility:754)
1 WTF::RefPtr<WTF::StringImpl>::~RefPtr() + 21 (RefPtr.h:62)
2 WTF::String::~String() + 21 (WTFString.h:137)
3 WTF::String::~String() + 21 (WTFString.h:137)
4 WTF::VectorDestructor<true, WTF::String>::destruct(WTF::String*, WTF::String*) + 47 (Vector.h:59)
5 WTF::VectorTypeOperations<WTF::String>::destruct(WTF::String*, WTF::String*) + 29 (Vector.h:225)
6 WTF::Vector<WTF::String, 0ul, WTF::CrashOnOverflow, 16ul>::shrink(unsigned long) + 132 (Vector.h:1026)
7 WTF::Vector<WTF::String, 0ul, WTF::CrashOnOverflow, 16ul>::~Vector() + 43 (Vector.h:631)
8 WTF::Vector<WTF::String, 0ul, WTF::CrashOnOverflow, 16ul>::~Vector() + 21 (Vector.h:634)
9 WebKit::NetworkCapture::MyStruct::~MyStruct() + 21 (NetworkCaptureManager.cpp:64)
10 WebKit::NetworkCapture::MyStruct::~MyStruct() + 21 (NetworkCaptureManager.cpp:64)
11 WTF::__storage_wrapper<WebKit::NetworkCapture::MyStruct>::__destroy() + 29 (Variant.h:444)
12 WTF::__variant_storage<WebKit::NetworkCapture::MyStruct, false>::__destroy(WTF::__storage_wrapper<WebKit::NetworkCapture::MyStruct>&) + 21 (Variant.h:481)
13 WTF::__variant_data<WebKit::NetworkCapture::MyStruct>::__destroy(WTF::in_place_tag (&)(WTF::__in_place_private::__value_holder<0ul>&)) + 28 (Variant.h:552)
14 void WTF::__destroy_op_table<WTF::Variant<WebKit::NetworkCapture::MyStruct>, WTF::__index_sequence<0l> >::__destroy_func<0l>(WTF::Variant<WebKit::NetworkCapture::MyStruct>*) + 45 (Variant.h:827)
15 WTF::Variant<WebKit::NetworkCapture::MyStruct>::__destroy_self() + 77 (Variant.h:1471)
16 WTF::__variant_base<WTF::Variant<WebKit::NetworkCapture::MyStruct>, false>::~__variant_base() + 21 (Variant.h:923)
17 WTF::Variant<WebKit::NetworkCapture::MyStruct>::~Variant() + 21 (Variant.h:1439)
18 WTF::Variant<WebKit::NetworkCapture::MyStruct>::~Variant() + 21 (Variant.h:1439)
The Variant default constructor is suppose to create an instance of its first type, so the fact that we're destructing one seems proper. Since the destruction is failing, I guess that the object wasn't properly created in the first place. I also note that MyStruct does not have a default constructor, so I don't know how Variant is creating one in the first place. And I don't know why a WTF::String is being destructed since the Vector should be empty.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>