|
Revision tags: release/13.4.0-p5, release/13.5.0-p1, release/14.2.0-p3, release/13.5.0, release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4, release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0, release/13.4.0 |
|
| #
ea68175b |
| 29-Jul-2024 |
Dag-Erling Smørgrav <[email protected]> |
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 att
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
(cherry picked from commit 9317242469f1ca682626d9806f8caf65d143c09a)
show more ...
|
|
Revision tags: release/14.1.0 |
|
| #
1b7672ed |
| 16-May-2024 |
Ed Maste <[email protected]> |
diff: honour -B flag with -q
PR: 278988 Reviewed by: bapt Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45220
(cherry picked from commit fb623aab3927a682
diff: honour -B flag with -q
PR: 278988 Reviewed by: bapt Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45220
(cherry picked from commit fb623aab3927a6825ff7731198ec2e33426f7607)
show more ...
|
|
Revision tags: release/13.3.0 |
|
| #
da290528 |
| 26-Feb-2024 |
Dag-Erling Smørgrav <[email protected]> |
diff: Fix --expand-tabs and --side-by-side.
* Overhaul column width and padding calculation. * Rewrite print_space() so it is now a) correct and b) understandable. * Rewrite tab expansion in fetch()
diff: Fix --expand-tabs and --side-by-side.
* Overhaul column width and padding calculation. * Rewrite print_space() so it is now a) correct and b) understandable. * Rewrite tab expansion in fetch() for the same reason.
This brings us in line with GNU diff for all cases I could think of.
Sponsored by: Klara, Inc. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44014
(cherry picked from commit 53de23f4d140becc3166e87665b0064f215a220e)
diff: Bump manual page date.
Sponsored by: Klara, Inc.
(cherry picked from commit 312b1076c6b0aff9bbcaff058b93385eaf607685)
show more ...
|
|
Revision tags: release/14.0.0 |
|
| #
1d386b48 |
| 16-Aug-2023 |
Warner Losh <[email protected]> |
Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
| #
e8f740fb |
| 20-Jun-2023 |
John Baldwin <[email protected]> |
diff: Fully comment out the jackpot variable.
This fixes a set but unused warning.
|
|
Revision tags: release/13.2.0 |
|
| #
54d65fdd |
| 14-Dec-2022 |
Kyle Evans <[email protected]> |
diff: restyle loop a bit
This is a bit more readable, and this loop is probably unlikely to gain any `continue` or `break`s.
Suggested by: pstef Differential Revision: https://reviews.freebsd.org/D
diff: restyle loop a bit
This is a bit more readable, and this loop is probably unlikely to gain any `continue` or `break`s.
Suggested by: pstef Differential Revision: https://reviews.freebsd.org/D37676
show more ...
|
| #
8bf187f3 |
| 14-Dec-2022 |
Kyle Evans <[email protected]> |
diff: fix side-by-side output with tabbed input
The previous logic conflated some things... in this block: - j: input characters rendered so far - nc: number of characters in the line - col: columns
diff: fix side-by-side output with tabbed input
The previous logic conflated some things... in this block: - j: input characters rendered so far - nc: number of characters in the line - col: columns rendered so far - hw: column width ((h)ard (w)idth?)
Comparing j to hw or col to nc are naturally wrong, as col and hw are limits on their respective counters and nc is already brought down to hw if the input line should be truncated to start with.
Right now, we end up easily truncating lines with tabs in them as we count each tab for $tabwidth lines in the input line, but we really should only be accounting for them in the column count. The problem is most easily demonstrated by the two input files added for the tests, the two tabbed lines lose at least a word or two even though there's plenty of space left in the row for each side.
Reviewed by: bapt, pstef Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D37676
show more ...
|
|
Revision tags: release/12.4.0 |
|
| #
6100374c |
| 16-Nov-2022 |
John Baldwin <[email protected]> |
diff: Don't (ab)use sprintf() as a kind of strcat().
Previously print_header() used sprintf() of a buffer to itself as a kind of string builder but without checking for overflows. This raised -Wfor
diff: Don't (ab)use sprintf() as a kind of strcat().
Previously print_header() used sprintf() of a buffer to itself as a kind of string builder but without checking for overflows. This raised -Wformat-truncation and -Wrestrict warnings in GCC. Instead, just conditionally print the new timestamp fields after the initial strftime()-formatted string. While here, use sizeof(buf) with strftime() rather than a magic number.
Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D36814
show more ...
|
| #
4e077171 |
| 16-Nov-2022 |
John Baldwin <[email protected]> |
diff: Don't treat null characters like carriage returns in readhash().
The implicit fall-through in the !D_FORCEASCII case caused null characters to be treated as carriage returns honoring the D_STR
diff: Don't treat null characters like carriage returns in readhash().
The implicit fall-through in the !D_FORCEASCII case caused null characters to be treated as carriage returns honoring the D_STRIPCR, D_FOLDBLANKS, and D_IGNOREBLANKS flags.
Reported by: GCC -Wimplicit-fallthrough Reviewed by: bapt Fixes: 3cbf98e2bee9 diff: read whole files to determine if they are ASCII text Differential Revision: https://reviews.freebsd.org/D36813
show more ...
|
| #
3736b2dd |
| 03-Oct-2022 |
John Baldwin <[email protected]> |
diff: Fix a use after free as well as a memory leak in change().
When -B or -I are used, change() evaluates the lines in a hunk to determine if it is a hunk that should be ignored. It does this by
diff: Fix a use after free as well as a memory leak in change().
When -B or -I are used, change() evaluates the lines in a hunk to determine if it is a hunk that should be ignored. It does this by reading each candidate line into a mallocated buffer via preadline() and then calling ignoreline(). Previously the buffer was freed as a side effect of ignoreline_pattern() called from ignoreline(). However, if only -B was specified, then ignoreline_pattern() was not called and the lines were leaked. If both options were specified, then ignoreline_pattern() was called before checking for a blank line so that the second check was a use after free.
To fix, pull the free() out of ignoreline_pattern() and instead do it up in change() so that is paired with preadline().
While here, simplify ignoreline() by checking for the -B and -I cases individually without a separate clause for when both are set. Also, do the cheaper check (-B) first, and remove a false comment (this function is only called if at least one of -I or -B are specified).
Reviewed by: emaste Reported by: GCC 12 -Wuse-after-free Differential Revision: https://reviews.freebsd.org/D36822
show more ...
|
|
Revision tags: release/13.1.0 |
|
| #
4be7d087 |
| 01-Mar-2022 |
Tom Jones <[email protected]> |
diff: Use start of change when searching for function
Use the start of change when searching for a function rather than the start of the context. In short functions if this could result in search fo
diff: Use start of change when searching for function
Use the start of change when searching for a function rather than the start of the context. In short functions if this could result in search for the function name starting from before the function definition.
PR: 262086 Reviewed by: bapt, mckusick, mhorne Sponsored by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D34328
show more ...
|
| #
8f79bd9b |
| 18-Feb-2022 |
Tom Jones <[email protected]> |
diff: Detect Objective-C methods
When searching back for function definitions, consider lines starting with '+' and '-', this allows us to pick up Objective-C methods as well as C style function def
diff: Detect Objective-C methods
When searching back for function definitions, consider lines starting with '+' and '-', this allows us to pick up Objective-C methods as well as C style function definitions.
Reviewed by: bapt Sponsored by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D34202
show more ...
|
|
Revision tags: release/12.3.0 |
|
| #
824bbb9a |
| 07-Oct-2021 |
Mariusz Zaborski <[email protected]> |
diff: consider two files with same inodes as identical
Obtained from: OpenBSD MFC after: 1 week
|
| #
e51aabf8 |
| 05-Sep-2021 |
Piotr Pawel Stefaniak <[email protected]> |
diff: implement option -F (--show-function-line)
With unified and context diffs, show the last line that matches the provided pattern before the context.
Reviewed by: bapt Differential Revision: ht
diff: implement option -F (--show-function-line)
With unified and context diffs, show the last line that matches the provided pattern before the context.
Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D31714
show more ...
|
| #
f38702e5 |
| 05-Sep-2021 |
Cameron Katri <[email protected]> |
diff(1): Add --color support
Adds a --color flag to diff(1) that supports the same options as GNU's diff(1). The colors are customizable with the env var DIFFCOLORS in a format similar to grep(1)'s
diff(1): Add --color support
Adds a --color flag to diff(1) that supports the same options as GNU's diff(1). The colors are customizable with the env var DIFFCOLORS in a format similar to grep(1)'s GREPCOLORS. An example would be 04;36:41 for additions to be underlined light blue, and deletions have a red background.
Differential Revision: https://reviews.freebsd.org/D30545
show more ...
|
| #
7760b854 |
| 05-Sep-2021 |
Piotr Pawel Stefaniak <[email protected]> |
diff: decrease indent level
An upcoming change will add more code in the loop.
|
| #
2171b2cb |
| 05-Sep-2021 |
Piotr Pawel Stefaniak <[email protected]> |
diff: avoid applying offsets to null pointer
This was the only instance of undefined behavior I could find so far.
|
| #
bcf2e78d |
| 05-Sep-2021 |
Piotr Pawel Stefaniak <[email protected]> |
diff: replace isqrt() with sqrt()
Remove cruft and use a system-provided and maintained function instead.
|
| #
e43df07e |
| 04-Sep-2021 |
Piotr Pawel Stefaniak <[email protected]> |
diff: move functions around and reduce their visibility
Most of them become static. There will be more such functions added in upcoming commits, so they would be inconsistent with existing code. Imp
diff: move functions around and reduce their visibility
Most of them become static. There will be more such functions added in upcoming commits, so they would be inconsistent with existing code. Improve the existing code instead of reinforcing the unwanted pattern.
show more ...
|
| #
03582021 |
| 29-Aug-2021 |
Piotr Pawel Stefaniak <[email protected]> |
diff: improve code style
Reflow comments, strip trailing space, improve wrapping of lines.
|
| #
3cbf98e2 |
| 22-Aug-2021 |
Piotr Pawel Stefaniak <[email protected]> |
diff: read whole files to determine if they are ASCII text
Before this change, only the first BUFSIZE bytes were checked.
Reviewed by: bapt (previous version) Differential Revision: https://reviews
diff: read whole files to determine if they are ASCII text
Before this change, only the first BUFSIZE bytes were checked.
Reviewed by: bapt (previous version) Differential Revision: https://reviews.freebsd.org/D31639
show more ...
|
| #
af2f0164 |
| 22-Aug-2021 |
Piotr Pawel Stefaniak <[email protected]> |
diff: don't output carriage returns that were stripped on input
--strip-trailing-cr worked as intended for comparison between files, but the characters were still present in final output.
|
| #
c78f449d |
| 06-Jul-2021 |
Alex Richardson <[email protected]> |
usr.bin/diff: fix UBSan error in readhash
UBSan complains about the `sum = sum * 127 + chrtran(t);` line below since that can overflow an `int`. Use `unsigned int` instead to ensure that overflow is
usr.bin/diff: fix UBSan error in readhash
UBSan complains about the `sum = sum * 127 + chrtran(t);` line below since that can overflow an `int`. Use `unsigned int` instead to ensure that overflow is well-defined.
Reviewed By: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31075
show more ...
|
|
Revision tags: release/13.0.0 |
|
| #
c69047ca |
| 02-Feb-2021 |
Baptiste Daroussin <[email protected]> |
Revert "diff: eliminate a useless lseek"
This changes breaks when one of the files is stdin
This reverts commit fa977a3b2bb2d0e6c2957b14474c31b58dd3a8e1.
Reported by: olivier
|
| #
7a57c9cb |
| 27-Jan-2021 |
Baptiste Daroussin <[email protected]> |
diff: eleminitate useless macros
The diff_output was not bringing any values but was obfuscating the code.
|