WebKit Bugzilla
Attachment 370317 Details for
Bug 188799
: WeakPtr breaks vtables when upcasting to base classes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188799-20190521074735.patch (text/plain), 4.36 KB, created by
Jer Noble
on 2019-05-21 07:47:36 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jer Noble
Created:
2019-05-21 07:47:36 PDT
Size:
4.36 KB
patch
obsolete
>Subversion Revision: 245248 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 9d97875d8d8322381f7de23683758a25eebf9d76..1765a5ab785f77dffba930495f7f8148fd591874 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,19 @@ >+2019-05-21 Jer Noble <jer.noble@apple.com> >+ >+ WeakPtr breaks vtables when upcasting to base classes >+ https://bugs.webkit.org/show_bug.cgi?id=188799 >+ <rdar://problem/50952417> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a runtime ASSERT that the results of static_cast == reinterpret_cast, which conveniently turns >+ into a compile-time error when that test fails, catching a potential unsafe casting operation between >+ types with muliple inheritance. >+ >+ * wtf/WeakPtr.h: >+ (WTF::weak_reference_upcast): >+ (WTF::weak_reference_downcast): >+ > 2019-05-13 Youenn Fablet <youenn@apple.com> > > Use kDNSServiceFlagsKnownUnique for DNSServiceRegisterRecord only on platforms supporting it >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 5a861a3181522128005fdb154bbd30ba802e9eb9..d88af7aa589e4f5f9b18ed8c17cc2a154dc1097c 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2019-05-21 Jer Noble <jer.noble@apple.com> >+ >+ WeakPtr breaks vtables when upcasting to base classes >+ https://bugs.webkit.org/show_bug.cgi?id=188799 >+ <rdar://problem/50952417> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Fix some unsafe cast operations. >+ >+ * Modules/mediastream/MediaStreamTrack.cpp: >+ (WebCore::MediaStreamTrack::applyConstraints): >+ * Modules/speech/SpeechSynthesis.cpp: >+ (WebCore::SpeechSynthesis::SpeechSynthesis): >+ > 2019-05-20 Jer Noble <jer.noble@apple.com> > > Provide an explicit UIModalPresentation style when creating an AVPlayerViewController for fullscreen. >diff --git a/Source/WTF/wtf/WeakPtr.h b/Source/WTF/wtf/WeakPtr.h >index 2715d1fba31467adc9c89b33d51019a99a362d7b..da7dc6620c94612a1b64ed659e2ce451dc971e35 100644 >--- a/Source/WTF/wtf/WeakPtr.h >+++ b/Source/WTF/wtf/WeakPtr.h >@@ -148,12 +148,14 @@ private: > template<typename T, typename U> inline WeakReference<T>* weak_reference_upcast(WeakReference<U>* weakReference) > { > static_assert(std::is_convertible<U*, T*>::value, "U* must be convertible to T*"); >+ ASSERT(static_cast<T*>(weakReference->get()) == reinterpret_cast<T*>(weakReference->get())); > return reinterpret_cast<WeakReference<T>*>(weakReference); > } > > template<typename T, typename U> inline WeakReference<T>* weak_reference_downcast(WeakReference<U>* weakReference) > { > static_assert(std::is_convertible<T*, U*>::value, "T* must be convertible to U*"); >+ ASSERT(static_cast<T*>(weakReference->get()) == reinterpret_cast<T*>(weakReference->get())); > return reinterpret_cast<WeakReference<T>*>(weakReference); > } > >diff --git a/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp b/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp >index 8399d879bab569a04c55f6431c857e321ae249dd..96228e251c6486a79f9554bc23aea2019d762f48 100644 >--- a/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp >+++ b/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp >@@ -365,7 +365,7 @@ void MediaStreamTrack::applyConstraints(const Optional<MediaTrackConstraints>& c > { > m_promise = WTFMove(promise); > >- auto completionHandler = [this, weakThis = makeWeakPtr(*this), constraints](auto&& error) mutable { >+ auto completionHandler = [this, weakThis = makeWeakPtr<MediaProducer>(*this), constraints](auto&& error) mutable { > if (!weakThis || !m_promise) > return; > if (error) { >diff --git a/Source/WebCore/Modules/speech/SpeechSynthesis.cpp b/Source/WebCore/Modules/speech/SpeechSynthesis.cpp >index ba63a7890dfc86ec062cde66d7ba50d5585d7c0b..7a3663be5ccebb8e5937016ec60977ec23088ea3 100644 >--- a/Source/WebCore/Modules/speech/SpeechSynthesis.cpp >+++ b/Source/WebCore/Modules/speech/SpeechSynthesis.cpp >@@ -52,7 +52,7 @@ SpeechSynthesis::SpeechSynthesis(WeakPtr<SpeechSynthesisClient> client) > , m_speechSynthesisClient(client) > { > if (m_speechSynthesisClient) >- m_speechSynthesisClient->setObserver(makeWeakPtr(this)); >+ m_speechSynthesisClient->setObserver(makeWeakPtr<SpeechSynthesisClientObserver>(this)); > } > > void SpeechSynthesis::setPlatformSynthesizer(std::unique_ptr<PlatformSpeechSynthesizer> synthesizer)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188799
:
370317
|
370321
|
370340
|
370386
|
370776
|
370790
|
370792
|
370794
|
370809