Skip to content
Permalink
Browse files
RenderThemeCocoa::mediaControlsFormattedStringForDuration may cause a…
… crash due to unhandled Obj-C exception

https://bugs.webkit.org/show_bug.cgi?id=178716
<rdar://problem/35112900>

Patch by Antoine Quint <graouts@apple.com> on 2017-10-24
Reviewed by Dean Jackson.

* rendering/RenderThemeCocoa.mm:
(WebCore::RenderThemeCocoa::mediaControlsFormattedStringForDuration):

Canonical link: https://commits.webkit.org/194892@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223896 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
graouts authored and webkit-commit-queue committed Oct 24, 2017
1 parent a57e588 commit 4886f7b6d0493971043a5b67e8848d49ac3e4a8e
Showing with 14 additions and 0 deletions.
  1. +11 −0 Source/WebCore/ChangeLog
  2. +3 −0 Source/WebCore/rendering/RenderThemeCocoa.mm
@@ -1,3 +1,14 @@
2017-10-24 Antoine Quint <graouts@apple.com>

RenderThemeCocoa::mediaControlsFormattedStringForDuration may cause a crash due to unhandled Obj-C exception
https://bugs.webkit.org/show_bug.cgi?id=178716
<rdar://problem/35112900>

Reviewed by Dean Jackson.

* rendering/RenderThemeCocoa.mm:
(WebCore::RenderThemeCocoa::mediaControlsFormattedStringForDuration):

2017-10-24 Ryosuke Niwa <rniwa@webkit.org>

SizesAttributeParser::SizesAttributeParser triggers layout
@@ -46,6 +46,7 @@

#if ENABLE(VIDEO)
#include "LocalizedStrings.h"
#include <wtf/BlockObjCExceptions.h>
#endif

namespace WebCore {
@@ -117,6 +118,7 @@ static PKPaymentButtonType toPKPaymentButtonType(ApplePayButtonType type)
if (!std::isfinite(durationInSeconds))
return WEB_UI_STRING("indefinite time", "accessibility help text for an indefinite media controller time value");

BEGIN_BLOCK_OBJC_EXCEPTIONS;
if (!m_durationFormatter) {
m_durationFormatter = adoptNS([NSDateComponentsFormatter new]);
m_durationFormatter.get().unitsStyle = NSDateComponentsFormatterUnitsStyleFull;
@@ -125,6 +127,7 @@ static PKPaymentButtonType toPKPaymentButtonType(ApplePayButtonType type)
m_durationFormatter.get().maximumUnitCount = 2;
}
return [m_durationFormatter.get() stringFromTimeInterval:durationInSeconds];
END_BLOCK_OBJC_EXCEPTIONS;
#else
return emptyString();
#endif

0 comments on commit 4886f7b

Please sign in to comment.