fix: big endian bug in V8 serialization (#44794)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2024-11-22 12:55:55 -05:00 committed by GitHub
parent 0c83fb1540
commit 67ccd2792e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,6 +4,7 @@
#include "shell/common/v8_value_serializer.h"
#include <cstdint>
#include <utility>
#include <vector>
@ -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 {
@ -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