diff --git a/NEWS b/NEWS index eae32b2..2432e4f 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,12 @@ GNU diffutils NEWS -*- outline -*- ** Bug fixes + Using an invalid regular expression with --ignore-matching-lines=RE (-I) + no longer causes stack overflow. Before, with an invocation like the + following, diff would diagnose the error, but would still proceed to + blow the stack: diff -Ia -I\\ <(echo) <(echo b) + [bug introduced in 2.9] + diff no longer mishandles line numbers exceeding 2**31 on Mingw-w64. the ---presume-output-tty (ostensibly test-only) option would cause diff --git a/tests/Makefile.am b/tests/Makefile.am index 66e25a5..2c44609 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -9,6 +9,7 @@ TESTS = \ diff3 \ excess-slash \ help-version \ + invalid-re \ function-line-vs-leading-space \ ignore-matching-lines \ label-vs-func \ diff --git a/tests/invalid-re b/tests/invalid-re new file mode 100755 index 0000000..0732a1f --- /dev/null +++ b/tests/invalid-re @@ -0,0 +1,18 @@ +#!/bin/sh +# Ensure we diagnose and fail upon first invalid -I regex. + +. "${srcdir=.}/init.sh"; path_prepend_ ../src + +fail=0 + +echo > a || framework_failure_ +echo b > b || framework_failure_ +echo 'diff: \: Trailing backslash' > exp-err || framework_failure_ + +# This must fail with an exit status of 2: +returns_ 2 diff -Ix -I\\ a b > out 2> err || fail=1 + +compare /dev/null out || fail=1 +compare exp-err err || fail=1 + +Exit $fail