Bug 1404226 - Fix ubsan runtime error for mozilla::ipc::Transport::Mode enum. r=billm
authorArthur Edelstein <arthuredelstein@gmail.com>
Mon, 02 Oct 2017 02:03:00 -0400
changeset 384153 04b99fcf7234a31fdb535a5fc674bd1a487093c5
parent 384152 9c1d08a0deaeb52ebe0334a5d9ccabe757128c5f
child 384154 64c4a8859b6cdaf04a1be21800473f0775b4fd30
push id95718
push userryanvm@gmail.com
push dateTue, 03 Oct 2017 12:45:19 +0000
treeherdermozilla-inbound@04b99fcf7234 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1404226
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1404226 - Fix ubsan runtime error for mozilla::ipc::Transport::Mode enum. r=billm
ipc/glue/ProtocolUtils.h
--- a/ipc/glue/ProtocolUtils.h
+++ b/ipc/glue/ProtocolUtils.h
@@ -621,28 +621,32 @@ public:
       , mMode(aMode)
       , mTransport(aTransport)
       , mMyPid(aMyPid)
       , mOtherPid(aOtherPid)
     {}
 
     Endpoint(Endpoint&& aOther)
       : mValid(aOther.mValid)
-      , mMode(aOther.mMode)
       , mTransport(aOther.mTransport)
       , mMyPid(aOther.mMyPid)
       , mOtherPid(aOther.mOtherPid)
     {
+        if (aOther.mValid) {
+            mMode = aOther.mMode;
+        }
         aOther.mValid = false;
     }
 
     Endpoint& operator=(Endpoint&& aOther)
     {
         mValid = aOther.mValid;
-        mMode = aOther.mMode;
+        if (aOther.mValid) {
+            mMode = aOther.mMode;
+        }
         mTransport = aOther.mTransport;
         mMyPid = aOther.mMyPid;
         mOtherPid = aOther.mOtherPid;
 
         aOther.mValid = false;
         return *this;
     }