From ca99c524e828cc1a1cfeff3cdfc5349f87143829 Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Thu, 24 Nov 2016 15:56:01 +0000 Subject: ptx: fix an invalid heap reference with short --width * src/ptx.c (fix_output_parameters): Ensure line_width doesn't go negative, which can happen when the --width is less than the --gap-size. * tests/misc/ptx-overrun.sh: Add a test case that triggers with ASAN. (Note the longer filename is needed to trigger). Fixes http://bugs.gnu.org/25011 --- tests/misc/ptx-overrun.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests') diff --git a/tests/misc/ptx-overrun.sh b/tests/misc/ptx-overrun.sh index a4f2e382e..3b4681264 100755 --- a/tests/misc/ptx-overrun.sh +++ b/tests/misc/ptx-overrun.sh @@ -41,4 +41,9 @@ ptx ws.in ws.in | sort | uniq -u > out compare /dev/null out || fail=1 +# Trigger an invalid heap reference noticed by gcc -fsanitize=address +# from coreutils-8.25 and earlier. +echo a > a +ptx -w1 -A $PWD/a >/dev/null || fail=1 + Exit $fail -- cgit v1.2.3-54-g00ecf