Title: [290931] branches/safari-613-branch/Source/WebKit
Revision
290931
Author
[email protected]
Date
2022-03-07 14:09:52 -0800 (Mon, 07 Mar 2022)

Log Message

Cherry-pick r290246. rdar://problem/85811396

    Change IPC encoding of boolean type to use one bit
    https://bugs.webkit.org/show_bug.cgi?id=236801
    rdar://85811396

    Patch by Simon Lewis <[email protected]> on 2022-02-21
    Reviewed by Chris Dumez.

    This patch ensures that only the lower bit is set in a boolean for IPC messages.

    * Platform/IPC/ArgumentCoder.h:
    (IPC::ArgumentCoder<bool>::encode):
    (IPC::ArgumentCoder<bool>::decode):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290246 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-613-branch/Source/WebKit/ChangeLog (290930 => 290931)


--- branches/safari-613-branch/Source/WebKit/ChangeLog	2022-03-07 22:09:49 UTC (rev 290930)
+++ branches/safari-613-branch/Source/WebKit/ChangeLog	2022-03-07 22:09:52 UTC (rev 290931)
@@ -1,5 +1,38 @@
 2022-03-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r290246. rdar://problem/85811396
+
+    Change IPC encoding of boolean type to use one bit
+    https://bugs.webkit.org/show_bug.cgi?id=236801
+    rdar://85811396
+    
+    Patch by Simon Lewis <[email protected]> on 2022-02-21
+    Reviewed by Chris Dumez.
+    
+    This patch ensures that only the lower bit is set in a boolean for IPC messages.
+    
+    * Platform/IPC/ArgumentCoder.h:
+    (IPC::ArgumentCoder<bool>::encode):
+    (IPC::ArgumentCoder<bool>::decode):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290246 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-21  Simon Lewis  <[email protected]>
+
+            Change IPC encoding of boolean type to use one bit
+            https://bugs.webkit.org/show_bug.cgi?id=236801
+            rdar://85811396
+
+            Reviewed by Chris Dumez.
+
+            This patch ensures that only the lower bit is set in a boolean for IPC messages.
+
+            * Platform/IPC/ArgumentCoder.h:
+            (IPC::ArgumentCoder<bool>::encode):
+            (IPC::ArgumentCoder<bool>::decode):
+
+2022-03-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r289121. rdar://problem/88492251
 
     Fix App Privacy Report redirect attribution

Modified: branches/safari-613-branch/Source/WebKit/Platform/IPC/ArgumentCoder.h (290930 => 290931)


--- branches/safari-613-branch/Source/WebKit/Platform/IPC/ArgumentCoder.h	2022-03-07 22:09:49 UTC (rev 290930)
+++ branches/safari-613-branch/Source/WebKit/Platform/IPC/ArgumentCoder.h	2022-03-07 22:09:52 UTC (rev 290931)
@@ -75,6 +75,25 @@
     }
 };
 
+template<>
+struct ArgumentCoder<bool> {
+    template<typename Encoder>
+    static void encode(Encoder& encoder, bool value)
+    {
+        uint8_t data = "" ? 1 : 0;
+        encoder << data;
+    }
+
+    template<typename Decoder>
+    static std::optional<bool> decode(Decoder& decoder)
+    {
+        uint8_t data;
+        if (decoder.decodeFixedLengthData(&data, sizeof(uint8_t), alignof(uint8_t)))
+            return !!data; // This ensures that only the lower bit is set in a boolean for IPC messages
+        return std::nullopt;
+    }
+};
+
 template<typename T>
 struct ArgumentCoder<T, typename std::enable_if_t<std::is_arithmetic_v<T>>> {
     template<typename Encoder>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to