opnsense-src/lib/libc
Warner Losh 02ebbc781f swab: Fix implementation to support overlapping copies
A number of image processing packages assume that swab() can handle to
and from being the same. However, POSIX.1 states that overlapping
buffers produces undefined results. Our old implementation would produce
coherent results, but the recent change to the musl-inspired code does
not. Since there's complaints in the forums for these image processing
packages for musl and now FreeBSD, update the algorithm to just read a
word at a time and bswap16 the results. All FreeBSD's architecutres
support unaligned access in userland, and swab is not used in the kernel
(g_part_apm has its own copy), so opt for even simpler code that's
easier to understand. This makes the overlapping behavior match i386 again,
since its assembler routine for swab handles overlapping correctly.

PR: 283698
Sponsored by: Netflix
Reviewed by:	nwhitehorn
Differential Revision:	https://reviews.freebsd.org/D48259
2025-01-06 16:46:05 -07:00
..
aarch64 libc/aarch64: Remove an unneeded weak symbol 2024-08-21 10:16:10 +00:00
amd64 lib/libc/amd64/string: fix overread condition in memccpy 2024-07-29 21:36:10 +02:00
arm Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
capability cap_rights_is_empty: add MLINK 2024-12-02 15:35:40 -05:00
compat-43 Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
csu libc/csu: Unify INIT_RELOCS across architectures 2024-10-19 00:48:52 +01:00
db Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
gdtoa Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
gen libc: lib_malloc_aligned(): add a missing NULL check 2024-12-08 11:14:36 -08:00
gmon Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
i386 Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
iconv Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
include libc, libthr: coordinate stubs for pthread_{suspend,resume}_all_np 2024-11-13 20:48:05 -06:00
inet Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
isc Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
locale Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
md libmd, kern, stand: consolidate md5 implementations (NFC) 2024-09-29 22:34:18 -05:00
nameser Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
net manuals: Remove trailing spaces 2024-11-04 11:26:14 -04:00
nls libc: remove some XXX for russian translations of errnos 2024-11-03 18:59:16 +02:00
posix1e manuals: Fix "missing end of block" errors 2024-10-07 15:40:58 -03:00
powerpc Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
powerpc64 Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
powerpcspe Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
quad Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
regex Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
resolv Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
riscv Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
rpc Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
secure libmd, kern, stand: consolidate md5 implementations (NFC) 2024-09-29 22:34:18 -05:00
softfloat libc/softfloat: we don't export _fp[gs]et* symbols 2024-03-13 20:35:41 +00:00
stdio fgets.3: document gets_s() __STDC_WANT_LIB_EXT1__ 2024-12-06 13:20:19 -05:00
stdlib jemalloc: Move generated files into lib/libc tree 2024-12-13 16:04:39 -07:00
stdtime strptime: Fix day-of-week calculation. 2024-12-09 13:38:22 +01:00
string swab: Fix implementation to support overlapping copies 2025-01-06 16:46:05 -07:00
sys libc: switch to __weak_symbol for fortified interpose stubs 2024-07-16 00:12:28 -05:00
tests Fix lib/libc/nss/getgr_test with large numbers of groups 2025-01-01 13:23:47 -07:00
uuid Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
x86/gen Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
xdr libc/xdr: remove bogus lseek(2) for xdr streams 2025-01-06 08:22:14 -08:00
yp Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
libc.ldscript Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:29 -06:00
libc_nossp.ldscript Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:29 -06:00
Makefile libmd, kern, stand: consolidate md5 implementations (NFC) 2024-09-29 22:34:18 -05:00
Makefile.depend Update Makefile.depend files 2024-10-14 10:26:17 -07:00
Makefile.depend.options Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Versions.def Create namespace for the symbols added during 15-CURRENT cycle 2023-09-22 10:16:29 +02:00