mirror of
https://github.com/Zygo/bees.git
synced 2025-05-17 21:35:45 +02:00
fs: avoid unaligned access when copying btrfs search headers
The assignment operator will use member-wise assignment, which assumes the object's this pointer is aligned. That doesn't happen when the object in question is part of a btrfs search result, and aarch64 faults over it. Use memcpy instead, which has no alignment constraints. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
parent
69c3d99552
commit
a9cd19a5fe
@ -748,7 +748,7 @@ namespace crucible {
|
|||||||
BtrfsIoctlSearchHeader::set_data(const vector<uint8_t> &v, size_t offset)
|
BtrfsIoctlSearchHeader::set_data(const vector<uint8_t> &v, size_t offset)
|
||||||
{
|
{
|
||||||
THROW_CHECK2(invalid_argument, offset, v.size(), offset + sizeof(btrfs_ioctl_search_header) <= v.size());
|
THROW_CHECK2(invalid_argument, offset, v.size(), offset + sizeof(btrfs_ioctl_search_header) <= v.size());
|
||||||
*static_cast<btrfs_ioctl_search_header *>(this) = *reinterpret_cast<const btrfs_ioctl_search_header *>(&v[offset]);
|
memcpy(static_cast<btrfs_ioctl_search_header *>(this), &v[offset], sizeof(btrfs_ioctl_search_header));
|
||||||
offset += sizeof(btrfs_ioctl_search_header);
|
offset += sizeof(btrfs_ioctl_search_header);
|
||||||
THROW_CHECK2(invalid_argument, offset + len, v.size(), offset + len <= v.size());
|
THROW_CHECK2(invalid_argument, offset + len, v.size(), offset + len <= v.size());
|
||||||
m_data = Spanner<const uint8_t>(&v[offset], &v[offset + len]);
|
m_data = Spanner<const uint8_t>(&v[offset], &v[offset + len]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user