<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 - std::chrono::duration casts are prone to overflows"
href="https://bugs.webkit.org/show_bug.cgi?id=152045">152045</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>std::chrono::duration casts are prone to overflows
</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>zan@falconsigh.net
</td>
</tr>
<tr>
<th>CC</th>
<td>darin@apple.com
</td>
</tr></table>
<p>
<div>
<pre>Spun off from <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - [GTK] Avoid std::chrono::microseconds overflows in setSharedTimerFireInterval"
href="show_bug.cgi?id=144908">bug #144908</a>
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - [GTK] Avoid std::chrono::microseconds overflows in setSharedTimerFireInterval"
href="show_bug.cgi?id=144908">https://bugs.webkit.org/show_bug.cgi?id=144908</a>
Casting between different std::chrono::duration specializations (e.g. seconds or milliseconds to microseconds) can easily result in an overflow of the duration value. In the worst-case scenario we can end up using a negative value to schedule platform-specific timers. In case of GLib, this can end up in continuous and immediate timer dispatches (bugs #144908 and #150930).
Current suggestions revolve around using clamping and/or overflow checks that could maybe be baked into a std::chrono::duration template specialization.</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>