Title: [290246] trunk/Source/WebKit
- Revision
- 290246
- Author
- commit-qu...@webkit.org
- Date
- 2022-02-21 09:07:45 -0800 (Mon, 21 Feb 2022)
Log Message
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 <simon.le...@apple.com> 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):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (290245 => 290246)
--- trunk/Source/WebKit/ChangeLog 2022-02-21 15:46:11 UTC (rev 290245)
+++ trunk/Source/WebKit/ChangeLog 2022-02-21 17:07:45 UTC (rev 290246)
@@ -1,3 +1,17 @@
+2022-02-21 Simon Lewis <simon.le...@apple.com>
+
+ 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-02-21 Sihui Liu <sihui_...@apple.com>
Fetching website data may get wrong record after migrating data to general storage directory
Modified: trunk/Source/WebKit/Platform/IPC/ArgumentCoder.h (290245 => 290246)
--- trunk/Source/WebKit/Platform/IPC/ArgumentCoder.h 2022-02-21 15:46:11 UTC (rev 290245)
+++ trunk/Source/WebKit/Platform/IPC/ArgumentCoder.h 2022-02-21 17:07:45 UTC (rev 290246)
@@ -76,6 +76,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
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes