HardenedBSD/usr.bin/diff
Dag-Erling Smørgrav 9317242469 diff: Fix integer overflow.
The legacy Stone algorithm uses `int` to represent line numbers, array
indices, and array lengths.  If given inputs approaching `INT_MAX` lines,
it would overflow and attempt to allocate ridiculously large amounts of
memory.  To avoid this without penalizing non-pathological inputs,
switch a few variables to `size_t` and add checks while and immediately
after reading both inputs.

MFC after:	3 days
PR:		280371
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D46169
2024-07-29 16:02:29 +02:00
..
tests Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
diff.1 diff: Fix usage message and documentation. 2024-07-29 16:02:21 +02:00
diff.c diff: Fix usage message and documentation. 2024-07-29 16:02:21 +02:00
diff.h diff: Integrate libdiff from OpenBSD GoT. 2024-03-27 11:03:33 +01:00
diffdir.c diff: Sort headers. 2024-05-03 17:03:50 +02:00
diffreg_new.c diff: Warn if the atomizer detected truncation. 2024-05-20 15:26:46 +02:00
diffreg.c diff: Fix integer overflow. 2024-07-29 16:02:29 +02:00
Makefile diff: Integrate libdiff from OpenBSD GoT. 2024-03-27 11:03:33 +01:00
pr.c diff: Integrate libdiff from OpenBSD GoT. 2024-03-27 11:03:33 +01:00
pr.h
TODO
xmalloc.c diff: Integrate libdiff from OpenBSD GoT. 2024-03-27 11:03:33 +01:00
xmalloc.h