Update to 0.4.17

epel9
Josh Stone 7 years ago
parent 00a89844e8
commit b0b90b257c

@ -0,0 +1,35 @@
From e1a09f57546c9627ca576a39b84e2105d25b1e77 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 27 Sep 2018 23:03:52 -0700
Subject: [PATCH] Always write big-endian in numeric_extended_into
Before, this was transforming the number `to_be()`, then pulling out
least-significant bytes at shr 0, 8, 16, etc. This has the effect of
writing reversed bytes on a little-endian target. But since `to_be()`
does nothing on actual big-endian machines, they end up incorrectly
writing the true least-significant bytes first.
Instead, we can just reverse the order of the shift indexes, and then
the platform endianness is irrelevant.
Fixes #161.
---
src/header.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/header.rs b/src/header.rs
index 124c466d9874..0f2d7bd9c148 100644
--- a/src/header.rs
+++ b/src/header.rs
@@ -1422,7 +1422,7 @@ fn numeric_extended_into(dst: &mut [u8], src: u64) {
let len: usize = dst.len();
for (slot, val) in dst.iter_mut().zip(
repeat(0).take(len - 8) // to zero init extra bytes
- .chain((0..8).map(|x| ((src.to_be() >> (8 * x)) & 0xff) as u8)),
+ .chain((0..8).rev().map(|x| ((src >> (8 * x)) & 0xff) as u8)),
) {
*slot = val;
}
--
2.17.1

@ -17,6 +17,9 @@ Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{
# * No redox
Patch0: tar-0.4.15-fix-metadata.diff
# https://github.com/alexcrichton/tar-rs/pull/163
Patch1: 0001-Always-write-big-endian-in-numeric_extended_into.patch
ExclusiveArch: %{rust_arches}
BuildRequires: rust-packaging

Loading…
Cancel
Save