From eaa2a24345fba918eb7ad7a6a263e7e639d82d5f Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 31 Jan 2017 16:44:03 -0800 Subject: [PATCH] diff: avoid UMR with ---presume-output-tty * src/diff.c (main): Always define presume_output_tty. Otherwise, it would be read uninitialized. Introduced in v3.3-45-g17e2698 * NEWS (Bug fixes): Mention it. --- NEWS | 3 +++ src/diff.c | 1 + 2 files changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 030432f..0afee1b 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,9 @@ GNU diffutils NEWS -*- outline -*- diff no longer mishandles line numbers exceeding 2**31 on Mingw-w64. + the ---presume-output-tty (ostensibly test-only) option would cause + diff --color to read an uninitialized variable + ** Performance changes diff's default algorithm has been tweaked to deal better with larger diff --git a/src/diff.c b/src/diff.c index efcedf9..76851ac 100644 --- a/src/diff.c +++ b/src/diff.c @@ -296,6 +296,7 @@ main (int argc, char **argv) ignore_regexp_list.buf = &ignore_regexp; re_set_syntax (RE_SYNTAX_GREP | RE_NO_POSIX_BACKTRACKING); excluded = new_exclude (); + presume_output_tty = false; /* Decode the options. */ -- 2.8.0-rc2