summaryrefslogtreecommitdiff
path: root/tests/misc/tac-2-nonseekable.sh
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2016-11-27 15:09:53 +0000
committerPádraig Brady <P@draigBrady.com>2016-11-28 13:19:24 +0000
commita39641cbb8f37c5a19dd4820c6f6719c82d3e633 (patch)
treeee662cfc8add8265c1de488a9d281eba21c9d8a4 /tests/misc/tac-2-nonseekable.sh
parent6f30a99fa537adb029283cf2ef03cb4419350e6c (diff)
downloadcoreutils-a39641cbb8f37c5a19dd4820c6f6719c82d3e633.tar.xz
tac: fix mem corruption when failing to read non seekable inputs
This was detected with ASAN, but can also be seen without ASAN with: $ tac - - <&- tac: standard input: read error: Bad file descriptor *** Error in `tac': malloc(): memory corruption: 0x... * src/tac.c (copy_to_temp): Don't close our output stream on (possibly transient) output error, or on input error. (temp_stream): clearerr() on the stream about to be reused, to ensure future stream use is not impacted by transient errors. * tests/misc/tac-2-nonseekable.sh: Add a test case. * NEWS: Mention the bug fix. Fixes http://bugs.gnu.org/25041
Diffstat (limited to 'tests/misc/tac-2-nonseekable.sh')
-rwxr-xr-xtests/misc/tac-2-nonseekable.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/misc/tac-2-nonseekable.sh b/tests/misc/tac-2-nonseekable.sh
index 47e7849ad..d148218c1 100755
--- a/tests/misc/tac-2-nonseekable.sh
+++ b/tests/misc/tac-2-nonseekable.sh
@@ -36,4 +36,7 @@ for file in /proc/version /sys/kernel/profiling; do
fi
done
+# This failed due to heap corruption from v8.15-v8.25 inclusive.
+returns_ 1 tac - - <&- 2>err || fail=1
+
Exit $fail