From b68b0845c1b169f166d5d1b052d91ceffe775de1 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sat, 14 Apr 2018 22:39:35 +0200 Subject: [PATCH] Disable the experimental code, oops KKona --- src/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 43c3b2031..f8e81b63a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -104,7 +104,9 @@ void runNativeMessagingHost() auto &nmm = chatterino::singletons::NativeMessagingManager::getInstance(); +#if 0 bool bigEndian = isBigEndian(); +#endif while (true) { char size_c[4]; @@ -114,6 +116,9 @@ void runNativeMessagingHost() break; } + uint32_t size = *reinterpret_cast(size_c); +#if 0 + // To avoid breaking strict-aliasing rules and potentially inducing undefined behaviour, the following code can be run instead uint32_t size = 0; if (bigEndian) { size = size_c[3] | static_cast(size_c[2]) << 8 | @@ -122,6 +127,7 @@ void runNativeMessagingHost() size = size_c[0] | static_cast(size_c[1]) << 8 | static_cast(size_c[2]) << 16 | static_cast(size_c[3]) << 24; } +#endif char *b = (char *)malloc(size + 1); std::cin.read(b, size);