mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
deps: patch resb crate
Original commit message:
Fix resb on big endian platforms
Refs: https://github.com/unicode-org/icu4x/commit/d310df8b3fb1cbfc551682ccf80f378ed152da8e
Refs: https://github.com/unicode-org/icu4x/pull/7658
PR-URL: https://github.com/nodejs/node/pull/62138
Fixes: https://github.com/nodejs/node/issues/61808
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
1 parent
e39e1fdce8
commit
17c76c1775
20 files changed
+14
-10
No files matched your search
-2
@@ -243,8 +243,6 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "resb"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a067ab3b5ca3b4dc307d0de9cf75f9f5e6ca9717b192b2f28a36c83e5de9e76"
|
||||
dependencies = [
|
||||
"potential_utf",
|
||||
"serde_core",
|
||||
|
||||
Vendored
+4
@@ -30,3 +30,7 @@ version = "=0.1.0"
|
||||
default-features = false
|
||||
# This is necessary to enable a spec-compliance quirk when upgrading to v0.1.2
|
||||
# features = ["float64_representable_durations"]
|
||||
|
||||
[patch.crates-io]
|
||||
# Float https://github.com/unicode-org/icu4x/pull/7658 until crate is updated.
|
||||
resb = { path="patches/resb" }
|
||||
Vendored
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -473,7 +473,7 @@ fn read_u16(input: &[u8]) -> Result<(u16, &[u8]), BinaryDeserializerError> {
|
||||
let bytes = get_subslice(input, ..core::mem::size_of::<u16>())?
|
||||
.try_into()
|
||||
.unwrap();
|
||||
let value = u16::from_le_bytes(bytes);
|
||||
let value = u16::from_ne_bytes(bytes);
|
||||
|
||||
let rest = get_subslice(input, core::mem::size_of::<u16>()..)?;
|
||||
Ok((value, rest))
|
||||
+8
-3
@@ -23,6 +23,11 @@ const SYSTEM_CHARSET_FAMILY: CharsetFamily = CharsetFamily::Ascii;
|
||||
|
||||
/// Deserializes an instance of type `T` from bytes representing a binary ICU
|
||||
/// resource bundle.
|
||||
///
|
||||
/// The input data must be in the platform's native endianness. ICU4C resource
|
||||
/// bundles such as `zoneinfo64.res` are generated in both little endian and
|
||||
/// big endian formats; callers must ensure the appropriate format is provided
|
||||
/// for the target platform.
|
||||
pub fn from_words<'a, T>(input: &'a [u32]) -> Result<T, BinaryDeserializerError>
|
||||
where
|
||||
T: Deserialize<'a>,
|
||||
@@ -142,7 +147,7 @@ impl<'de> ResourceTreeDeserializer<'de> {
|
||||
))
|
||||
}
|
||||
};
|
||||
let descriptor = u32::from_le_bytes(descriptor);
|
||||
let descriptor = u32::from_ne_bytes(descriptor);
|
||||
|
||||
ResDescriptor::try_from(descriptor)
|
||||
}
|
||||
@@ -887,7 +892,7 @@ impl<'de> Resource16BitDeserializer<'de> {
|
||||
// exactly 2 bytes.
|
||||
#[expect(clippy::unwrap_used)]
|
||||
let bytes = <[u8; 2]>::try_from(bytes).unwrap();
|
||||
u16::from_le_bytes(bytes)
|
||||
u16::from_ne_bytes(bytes)
|
||||
});
|
||||
|
||||
char::decode_utf16(units)
|
||||
@@ -1255,7 +1260,7 @@ fn read_u32(input: &[u8]) -> Result<(u32, &[u8]), BinaryDeserializerError> {
|
||||
))?
|
||||
.try_into()
|
||||
.unwrap();
|
||||
let value = u32::from_le_bytes(bytes);
|
||||
let value = u32::from_ne_bytes(bytes);
|
||||
|
||||
let rest =
|
||||
input
|
||||
Vendored
+1
-4
@@ -113,11 +113,8 @@ impl TryFrom<&[u8]> for BinReprInfo {
|
||||
let (size, value) = read_u16(value)?;
|
||||
let (reserved_word, value) = read_u16(value)?;
|
||||
|
||||
// While the consumer is responsible for verifying acceptability of most
|
||||
// contents of the repr info, we explicitly depend on little endian data
|
||||
// in order to ensure compatibility with `zerovec`.
|
||||
let (endianness, value) = (Endianness::try_from(value[0])?, &value[1..]);
|
||||
if endianness != Endianness::Little {
|
||||
if (endianness == Endianness::Little) != cfg!(target_endian = "little") {
|
||||
return Err(BinaryDeserializerError::unsupported_format(
|
||||
"big-endian bundles are not supported",
|
||||
));
|
||||
Vendored
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user