Title: [234690] trunk/Source/ThirdParty/libwebrtc
Revision
234690
Author
[email protected]
Date
2018-08-08 05:07:33 -0700 (Wed, 08 Aug 2018)

Log Message

[libwebrtc] SafeSetError() in peerconnection.cc contains use-after-move of webrtc::RTCError variable
<https://webkit.org/b/188337>
<rdar://problem/42882908>

Reviewed by Eric Carlson.

* Source/webrtc/pc/peerconnection.cc:
(webrtc::SafeSetError): Make static since it's not used outside
this translation unit.
(webrtc::SafeSetError): Ditto.  Change first argument to
webrtc::RTCError&& to prevent unnecessary copying of std::move()
argument.  Fix bug by saving value of `error.ok()` before moving
to `*error_out`.
* WebKit/0013-Fix-SafeSetError-use-after-move.patch: Add patch.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (234689 => 234690)


--- trunk/Source/ThirdParty/libwebrtc/ChangeLog	2018-08-08 10:45:13 UTC (rev 234689)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog	2018-08-08 12:07:33 UTC (rev 234690)
@@ -1,3 +1,20 @@
+2018-08-06  David Kilzer  <[email protected]>
+
+        [libwebrtc] SafeSetError() in peerconnection.cc contains use-after-move of webrtc::RTCError variable
+        <https://webkit.org/b/188337>
+        <rdar://problem/42882908>
+
+        Reviewed by Eric Carlson.
+
+        * Source/webrtc/pc/peerconnection.cc:
+        (webrtc::SafeSetError): Make static since it's not used outside
+        this translation unit.
+        (webrtc::SafeSetError): Ditto.  Change first argument to
+        webrtc::RTCError&& to prevent unnecessary copying of std::move()
+        argument.  Fix bug by saving value of `error.ok()` before moving
+        to `*error_out`.
+        * WebKit/0013-Fix-SafeSetError-use-after-move.patch: Add patch.
+
 2018-08-03  Alex Christensen  <[email protected]>
 
         Fix spelling of "overridden"

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peerconnection.cc (234689 => 234690)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peerconnection.cc	2018-08-08 10:45:13 UTC (rev 234689)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peerconnection.cc	2018-08-08 12:07:33 UTC (rev 234690)
@@ -226,7 +226,7 @@
 }
 
 // Helper to set an error and return from a method.
-bool SafeSetError(webrtc::RTCErrorType type, webrtc::RTCError* error) {
+static bool SafeSetError(webrtc::RTCErrorType type, webrtc::RTCError* error) {
   if (error) {
     error->set_type(type);
   }
@@ -233,11 +233,12 @@
   return type == webrtc::RTCErrorType::NONE;
 }
 
-bool SafeSetError(webrtc::RTCError error, webrtc::RTCError* error_out) {
+static bool SafeSetError(webrtc::RTCError&& error, webrtc::RTCError* error_out) {
+  bool result = error.ok();
   if (error_out) {
     *error_out = std::move(error);
   }
-  return error.ok();
+  return result;
 }
 
 std::string GetSignalingStateString(

Added: trunk/Source/ThirdParty/libwebrtc/WebKit/0013-Fix-SafeSetError-use-after-move.patch (0 => 234690)


--- trunk/Source/ThirdParty/libwebrtc/WebKit/0013-Fix-SafeSetError-use-after-move.patch	                        (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/WebKit/0013-Fix-SafeSetError-use-after-move.patch	2018-08-08 12:07:33 UTC (rev 234690)
@@ -0,0 +1,27 @@
+diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peerconnection.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peerconnection.cc
+index 6281d57e3db..1bebb0509a1 100644
+--- a/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peerconnection.cc
++++ b/Source/ThirdParty/libwebrtc/Source/webrtc/pc/peerconnection.cc
+@@ -226,18 +226,19 @@ uint32_t ConvertIceTransportTypeToCandidateFilter(
+ }
+ 
+ // Helper to set an error and return from a method.
+-bool SafeSetError(webrtc::RTCErrorType type, webrtc::RTCError* error) {
++static bool SafeSetError(webrtc::RTCErrorType type, webrtc::RTCError* error) {
+   if (error) {
+     error->set_type(type);
+   }
+   return type == webrtc::RTCErrorType::NONE;
+ }
+ 
+-bool SafeSetError(webrtc::RTCError error, webrtc::RTCError* error_out) {
++static bool SafeSetError(webrtc::RTCError&& error, webrtc::RTCError* error_out) {
++  bool result = error.ok();
+   if (error_out) {
+     *error_out = std::move(error);
+   }
+-  return error.ok();
++  return result;
+ }
+ 
+ std::string GetSignalingStateString(
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to