diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2026-01-14 12:10:33 -0500 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2026-01-14 12:10:33 -0500 |
| commit | 2a5c5b8f7cddf14537707895fceb454cabc1b3bd (patch) | |
| tree | e88a292f3e6f372c17dd3973a02630c8cc01dbee /source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp | |
| parent | fef84fd8ae845e19cec0f6b9aac0e6451cca3d7a (diff) | |
swab: Correctly treat the data as misaligned
The __aligned attribute in the previous version applied to the location
of the pointers, not the data the pointers pointed to. While this
could be fixed by applying the attribute to a local typedef of uint16_t,
just using memcpy() for the unaligned access is simpler and ISO C.
This fixes the build on CHERI architectures which do not support
misaligned pointers and were thus failing with:
lib/libc/string/swab.c:12:18: error: alignment (1) of 'const uint16_t *' (aka 'const unsigned short *') is less than the required capability alignment (16) [-Werror,-Wcheri-capability-misuse]
12 | const uint16_t *f __aligned(1) = from;
|
Co-authored by: Jessica Clarke <jrtc27@FreeBSD.org>
Fixes: 02ebbc781f08 ("swab: Fix implementation to support overlapping copies")
Sponsored by: AFRL, DARPA
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D54399
Diffstat (limited to 'source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp')
0 files changed, 0 insertions, 0 deletions
