Title: [267539] trunk/Source
Revision
267539
Author
[email protected]
Date
2020-09-24 11:28:36 -0700 (Thu, 24 Sep 2020)

Log Message

Add libwebrtc.dylib version check
https://bugs.webkit.org/show_bug.cgi?id=216884
<rdar://problem/69441354>

Reviewed by Eric Carlson.

Source/ThirdParty/libwebrtc:

Introduce isMatchingBundleVersion to check libwebrtc.dylib version.

* Configurations/libwebrtc.iOS.exp:
* Configurations/libwebrtc.iOSsim.exp:
* Configurations/libwebrtc.mac.exp:
* Configurations/libwebrtc.xcconfig:
* Source/webrtc/sdk/WebKit/WebKitUtilities.h:
* Source/webrtc/sdk/WebKit/WebKitUtilities.mm:
(webrtc::isMatchingBundleVersion):

Source/WebCore:

Use webrtc::isMatchingBundleVersion to check for libwebrtc.dylib presence and for version matching.
If version does not match, crash the web process.
No change of behavior.

* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
(WebCore::LibWebRTCProvider::webRTCAvailable):
* platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
* platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.mm:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (267538 => 267539)


--- trunk/Source/ThirdParty/libwebrtc/ChangeLog	2020-09-24 18:23:57 UTC (rev 267538)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog	2020-09-24 18:28:36 UTC (rev 267539)
@@ -1,3 +1,21 @@
+2020-09-24  Youenn Fablet  <[email protected]>
+
+        Add libwebrtc.dylib version check
+        https://bugs.webkit.org/show_bug.cgi?id=216884
+        <rdar://problem/69441354>
+
+        Reviewed by Eric Carlson.
+
+        Introduce isMatchingBundleVersion to check libwebrtc.dylib version.
+
+        * Configurations/libwebrtc.iOS.exp:
+        * Configurations/libwebrtc.iOSsim.exp:
+        * Configurations/libwebrtc.mac.exp:
+        * Configurations/libwebrtc.xcconfig:
+        * Source/webrtc/sdk/WebKit/WebKitUtilities.h:
+        * Source/webrtc/sdk/WebKit/WebKitUtilities.mm:
+        (webrtc::isMatchingBundleVersion):
+
 2020-09-09  David Kilzer  <[email protected]>
 
         [WebRTC] Fix uninitialized fields in FilterAnalyzer::ConsistentFilterDetector, FilterAnalyzer::FilterAnalysisState and InterArrival::TimestampGroup

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp (267538 => 267539)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp	2020-09-24 18:23:57 UTC (rev 267538)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp	2020-09-24 18:28:36 UTC (rev 267539)
@@ -328,3 +328,4 @@
 __ZN6webrtc14ParseCandidateERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN7cricket9CandidateEPNS_13SdpParseErrorEb
 __ZN7cricket27ICE_CANDIDATE_COMPONENT_RTPE
 __ZNK3rtc13SocketAddress5IsNilEv
+__ZN6webrtc23isMatchingBundleVersionEPKc

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp (267538 => 267539)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp	2020-09-24 18:23:57 UTC (rev 267538)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp	2020-09-24 18:28:36 UTC (rev 267539)
@@ -328,3 +328,4 @@
 __ZN6webrtc14ParseCandidateERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN7cricket9CandidateEPNS_13SdpParseErrorEb
 __ZN7cricket27ICE_CANDIDATE_COMPONENT_RTPE
 __ZNK3rtc13SocketAddress5IsNilEv
+__ZN6webrtc23isMatchingBundleVersionEPKc

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp (267538 => 267539)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp	2020-09-24 18:23:57 UTC (rev 267538)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp	2020-09-24 18:28:36 UTC (rev 267539)
@@ -326,3 +326,4 @@
 __ZN6webrtc14ParseCandidateERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPN7cricket9CandidateEPNS_13SdpParseErrorEb
 __ZN7cricket27ICE_CANDIDATE_COMPONENT_RTPE
 __ZNK3rtc13SocketAddress5IsNilEv
+__ZN6webrtc23isMatchingBundleVersionEPKc

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig (267538 => 267539)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig	2020-09-24 18:23:57 UTC (rev 267538)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig	2020-09-24 18:28:36 UTC (rev 267539)
@@ -26,7 +26,7 @@
 WARNING_CFLAGS = -Wno-deprecated-declarations $(inherited);
 
 // FIXME: Set WEBRTC_USE_BUILTIN_ISAC_FIX and WEBRTC_USE_BUILTIN_ISAC_FLOAT for iOS and Mac
-GCC_PREPROCESSOR_DEFINITIONS = GTEST_RELATIVE_PATH WEBRTC_OPUS_SUPPORT_120MS_PTIME=0 WEBRTC_POSIX WEBRTC_MAC SSL_USE_OPENSSL FEATURE_ENABLE_SSL HAVE_SRTP HAVE_NETINET_IN_H HAVE_OPENSSL_SSL_H SCTP_PROCESS_LEVEL_LOCKS SCTP_SIMPLE_ALLOCATOR SCTP_USE_OPENSSL_SHA1 __Userspace__ HAVE_SA_LEN HAVE_SCONN_LEN __APPLE_USE_RFC_2292 __Userspace_os_Darwin NON_WINDOWS_DEFINE HAVE_WEBRTC_VIDEO HAVE_WEBRTC_VOICE WEBRTC_INTELLIGIBILITY_ENHANCER=0 WEBRTC_APM_DEBUG_DUMP=0 WEBRTC_NS_FLOAT WEBRTC_USE_BUILTIN_ILBC WEBRTC_CODEC_ILBC WEBRTC_USE_BUILTIN_OPUS WEBRTC_CODEC_OPUS WEBRTC_CODEC_ISAC WEBRTC_CODEC_RED HAVE_STDINT_H HAVE_STDLIB_H HAVE_UINT64_T OPENSSL HAVE_CONFIG_H WEBRTC_WEBKIT_BUILD HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE  HAVE_SCTP WEBRTC_CODEC_G711 WEBRTC_CODEC_G722 WEBRTC_OPUS_VARIABLE_COMPLEXITY=0 WEBRTC_USE_BUILTIN_ISAC_FIX=1 WEBRTC_USE_BUILTIN_ISAC_FLOAT=0 USE_BUILTIN_SW_CODECS WEBRTC_WEBKIT_BUILD RTC_ENABLE_VP9 $(inherited);
+GCC_PREPROCESSOR_DEFINITIONS = GTEST_RELATIVE_PATH WEBRTC_OPUS_SUPPORT_120MS_PTIME=0 WEBRTC_POSIX WEBRTC_MAC SSL_USE_OPENSSL FEATURE_ENABLE_SSL HAVE_SRTP HAVE_NETINET_IN_H HAVE_OPENSSL_SSL_H SCTP_PROCESS_LEVEL_LOCKS SCTP_SIMPLE_ALLOCATOR SCTP_USE_OPENSSL_SHA1 __Userspace__ HAVE_SA_LEN HAVE_SCONN_LEN __APPLE_USE_RFC_2292 __Userspace_os_Darwin NON_WINDOWS_DEFINE HAVE_WEBRTC_VIDEO HAVE_WEBRTC_VOICE WEBRTC_INTELLIGIBILITY_ENHANCER=0 WEBRTC_APM_DEBUG_DUMP=0 WEBRTC_NS_FLOAT WEBRTC_USE_BUILTIN_ILBC WEBRTC_CODEC_ILBC WEBRTC_USE_BUILTIN_OPUS WEBRTC_CODEC_OPUS WEBRTC_CODEC_ISAC WEBRTC_CODEC_RED HAVE_STDINT_H HAVE_STDLIB_H HAVE_UINT64_T OPENSSL HAVE_CONFIG_H WEBRTC_WEBKIT_BUILD HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE  HAVE_SCTP WEBRTC_CODEC_G711 WEBRTC_CODEC_G722 WEBRTC_OPUS_VARIABLE_COMPLEXITY=0 WEBRTC_USE_BUILTIN_ISAC_FIX=1 WEBRTC_USE_BUILTIN_ISAC_FLOAT=0 USE_BUILTIN_SW_CODECS WEBRTC_WEBKIT_BUILD RTC_ENABLE_VP9 BUNDLE_VERSION=\"$BUNDLE_VERSION\" $(inherited);
 
 GCC_PREPROCESSOR_DEFINITIONS[sdk=macosx*] = $(inherited) WEBRTC_USE_VTB_HARDWARE_ENCODER;
 GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*] = $(inherited) WEBRTC_IOS;

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.h (267538 => 267539)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.h	2020-09-24 18:23:57 UTC (rev 267538)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.h	2020-09-24 18:28:36 UTC (rev 267539)
@@ -59,4 +59,5 @@
 
 CVPixelBufferPoolRef createPixelBufferPool(size_t width, size_t height);
 
+bool isMatchingBundleVersion(const char*);
 }

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.mm (267538 => 267539)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.mm	2020-09-24 18:23:57 UTC (rev 267538)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.mm	2020-09-24 18:28:36 UTC (rev 267539)
@@ -244,4 +244,9 @@
     return pool;
 }
 
+bool isMatchingBundleVersion(const char *bundleVersion)
+{
+    return !strcmp(bundleVersion, BUNDLE_VERSION);
 }
+
+}

Modified: trunk/Source/WebCore/ChangeLog (267538 => 267539)


--- trunk/Source/WebCore/ChangeLog	2020-09-24 18:23:57 UTC (rev 267538)
+++ trunk/Source/WebCore/ChangeLog	2020-09-24 18:28:36 UTC (rev 267539)
@@ -1,3 +1,22 @@
+2020-09-24  Youenn Fablet  <[email protected]>
+
+        Add libwebrtc.dylib version check
+        https://bugs.webkit.org/show_bug.cgi?id=216884
+        <rdar://problem/69441354>
+
+        Reviewed by Eric Carlson.
+
+        Use webrtc::isMatchingBundleVersion to check for libwebrtc.dylib presence and for version matching.
+        If version does not match, crash the web process.
+        No change of behavior.
+
+        * SourcesCocoa.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
+        (WebCore::LibWebRTCProvider::webRTCAvailable):
+        * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
+        * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.mm:
+
 2020-09-24  Chris Dumez  <[email protected]>
 
         Drop AudioNode::reset() and all its overrides

Modified: trunk/Source/WebCore/SourcesCocoa.txt (267538 => 267539)


--- trunk/Source/WebCore/SourcesCocoa.txt	2020-09-24 18:23:57 UTC (rev 267538)
+++ trunk/Source/WebCore/SourcesCocoa.txt	2020-09-24 18:28:36 UTC (rev 267539)
@@ -526,6 +526,7 @@
 platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm @no-unify
 platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm @no-unify
 platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp
+platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.mm
 platform/mediastream/mac/AVCaptureDeviceManager.mm @no-unify
 platform/mediastream/mac/AVVideoCaptureSource.mm @no-unify
 platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (267538 => 267539)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-09-24 18:23:57 UTC (rev 267538)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-09-24 18:28:36 UTC (rev 267539)
@@ -7592,6 +7592,7 @@
 		4176E88F23C348D2003E83FE /* MediaRecorderProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaRecorderProvider.h; sourceTree = "<group>"; };
 		4176E89123C34B75003E83FE /* MediaRecorderProvider.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MediaRecorderProvider.cpp; sourceTree = "<group>"; };
 		4177040B23F70CAB000C54EE /* MediaRecorderPrivate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaRecorderPrivate.cpp; sourceTree = "<group>"; };
+		4177D57B251CBE9500E8C66B /* LibWebRTCProviderCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = LibWebRTCProviderCocoa.mm; path = libwebrtc/LibWebRTCProviderCocoa.mm; sourceTree = "<group>"; };
 		4177F51C2382544000C04486 /* BaseAudioSharedUnit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseAudioSharedUnit.cpp; sourceTree = "<group>"; };
 		4177F51E2382545E00C04486 /* BaseAudioSharedUnit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseAudioSharedUnit.h; sourceTree = "<group>"; };
 		4178EF1424125B6C00193C74 /* NowPlayingManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NowPlayingManager.h; sourceTree = "<group>"; };
@@ -18904,6 +18905,7 @@
 				415747441E38699E00E914D8 /* LibWebRTCProvider.h */,
 				41B28B381F860BD100FB52AC /* LibWebRTCProviderCocoa.cpp */,
 				41B28B361F860BD000FB52AC /* LibWebRTCProviderCocoa.h */,
+				4177D57B251CBE9500E8C66B /* LibWebRTCProviderCocoa.mm */,
 				410E445F234373AD000173D4 /* LibWebRTCSocketIdentifier.h */,
 			);
 			name = libwebrtc;

Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp (267538 => 267539)


--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp	2020-09-24 18:23:57 UTC (rev 267538)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp	2020-09-24 18:28:36 UTC (rev 267539)
@@ -37,7 +37,7 @@
 #include <wtf/MainThread.h>
 #include <wtf/darwin/WeakLinking.h>
 
-WTF_WEAK_LINK_FORCE_IMPORT(webrtc::setApplicationStatus);
+WTF_WEAK_LINK_FORCE_IMPORT(webrtc::isMatchingBundleVersion);
 
 namespace WebCore {
 
@@ -80,7 +80,7 @@
 #if PLATFORM(IOS)
     return true;
 #else
-    return !!webrtc::setApplicationStatus;
+    return !!webrtc::isMatchingBundleVersion;
 #endif
 }
 
@@ -89,6 +89,7 @@
     if (webRTCAvailable())
         webrtc::registerWebKitVP9Decoder();
 }
+
 } // namespace WebCore
 
 #endif // USE(LIBWEBRTC)

Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h (267538 => 267539)


--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h	2020-09-24 18:23:57 UTC (rev 267538)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h	2020-09-24 18:28:36 UTC (rev 267539)
@@ -38,7 +38,7 @@
 
 class WEBCORE_EXPORT LibWebRTCProviderCocoa : public LibWebRTCProvider {
 public:
-    LibWebRTCProviderCocoa() = default;
+    LibWebRTCProviderCocoa();
     ~LibWebRTCProviderCocoa();
 
     std::unique_ptr<webrtc::VideoDecoderFactory> createDecoderFactory() override;

Copied: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.mm (from rev 267538, trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h) (0 => 267539)


--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.mm	                        (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.mm	2020-09-24 18:28:36 UTC (rev 267539)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "LibWebRTCProviderCocoa.h"
+
+#if USE(LIBWEBRTC)
+
+ALLOW_UNUSED_PARAMETERS_BEGIN
+#include <webrtc/sdk/WebKit/WebKitUtilities.h>
+ALLOW_UNUSED_PARAMETERS_END
+
+namespace WebCore {
+
+LibWebRTCProviderCocoa::LibWebRTCProviderCocoa()
+{
+    if (!webRTCAvailable())
+        return;
+
+    RELEASE_ASSERT_WITH_MESSAGE(webrtc::isMatchingBundleVersion([[NSBundle bundleWithIdentifier:@"com.apple.WebCore"].infoDictionary[(__bridge NSString *)kCFBundleVersionKey] UTF8String]), "WebCore and libwebrtc versions do not match");
+}
+
+} // namespace WebCore
+
+#endif // USE(LIBWEBRTC)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to