mirror of
https://https.git.savannah.gnu.org/git/diffutils.git
synced 2026-01-27 01:44:20 +00:00
Commit v3.3-42-g3b74a90, "FIXME: src/diff3: plug a leak" added an invalid use of free, leading to use-after-free in nearly any invocation of diff3. Revert that commit. * NEWS (Bug fixes): Mention it. * tests/diff3: New file, to add minimal test coverage. * tests/Makefile.am (TESTS): Add it. Reported by Bastian Beischer in http://bugs.gnu.org/24210
31 lines
529 B
Bash
31 lines
529 B
Bash
#!/bin/sh
|
|
# This would malfunction in diff-3.4
|
|
|
|
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
|
|
|
echo a > a || framework_failure_
|
|
echo b > b || framework_failure_
|
|
echo c > c || framework_failure_
|
|
cat <<'EOF' > exp || framework_failure_
|
|
====
|
|
1:1c
|
|
a
|
|
2:1c
|
|
b
|
|
3:1c
|
|
c
|
|
EOF
|
|
|
|
fail=0
|
|
|
|
diff3 a b c > out 2> err || fail=1
|
|
compare exp out || fail=1
|
|
compare /dev/null err || fail=1
|
|
|
|
# Repeat, but with all three files the same:
|
|
diff3 a a a > out 2> err || fail=1
|
|
compare /dev/null out || fail=1
|
|
compare /dev/null err || fail=1
|
|
|
|
Exit $fail
|