# HG changeset patch # User A. Wilcox # Date 1729710191 18000 # Wed Oct 23 14:03:11 2024 -0500 # Node ID 6102585e0d752de1729135d4c7d917e751b268c5 # Parent 61f7d9c0998e2ce8008cd15b187f86dfdba21a26 Bug 1926667 - Ensure JSStructuredCloneReader::readTransferMap respects endianness r?sfink Differential Revision: https://phabricator.services.mozilla.com/D226707 diff --git a/js/src/vm/StructuredClone.cpp b/js/src/vm/StructuredClone.cpp --- a/js/src/vm/StructuredClone.cpp +++ b/js/src/vm/StructuredClone.cpp @@ -3387,7 +3387,8 @@ bool JSStructuredCloneReader::readTransf } headerPos.write( - PairToUInt64(SCTAG_TRANSFER_MAP_HEADER, SCTAG_TM_TRANSFERRING)); + NativeEndian::swapToLittleEndian( + PairToUInt64(SCTAG_TRANSFER_MAP_HEADER, SCTAG_TM_TRANSFERRING))); uint64_t numTransferables; MOZ_ALWAYS_TRUE(in.readPair(&tag, &data)); @@ -3512,7 +3513,8 @@ bool JSStructuredCloneReader::readTransf MOZ_ASSERT(TransferableMapHeader(data) == SCTAG_TM_TRANSFERRING); #endif headerPos.write( - PairToUInt64(SCTAG_TRANSFER_MAP_HEADER, SCTAG_TM_TRANSFERRED)); + NativeEndian::swapToLittleEndian( + PairToUInt64(SCTAG_TRANSFER_MAP_HEADER, SCTAG_TM_TRANSFERRED))); return true; }