Skip to content

Commit

Permalink
fix: big endian bug in V8 serialization (electron#44776)
Browse files Browse the repository at this point in the history
  • Loading branch information
ckerr authored Nov 22, 2024
1 parent 1d55eb9 commit 4fd1b5b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions shell/common/v8_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "shell/common/v8_util.h"

#include <cstdint>
#include <utility>
#include <vector>

Expand All @@ -20,11 +21,11 @@
namespace electron {

namespace {
enum SerializationTag {
kNativeImageTag = 'i',
kTrailerOffsetTag = 0xFE,
kVersionTag = 0xFF
};

constexpr uint8_t kNativeImageTag = 'i';
constexpr uint8_t kTrailerOffsetTag = 0xFE;
constexpr uint8_t kVersionTag = 0xFF;

} // namespace

class V8Serializer : public v8::ValueSerializer::Delegate {
Expand Down Expand Up @@ -104,7 +105,7 @@ class V8Serializer : public v8::ValueSerializer::Delegate {
}

private:
void WriteTag(SerializationTag tag) { serializer_.WriteRawBytes(&tag, 1); }
void WriteTag(const uint8_t tag) { serializer_.WriteRawBytes(&tag, 1U); }

void WriteBlinkEnvelope(uint32_t blink_version) {
// Write a dummy blink version envelope for compatibility with
Expand Down

0 comments on commit 4fd1b5b

Please sign in to comment.