Subject: bug#16171: ptx: heap buffer overrun, when run with two file arguments

From: Bernhard Voelker <[email-masked]>
Date: Mon, 28 Apr 2014 23:01:06 +0200

On 04/28/2014 03:52 PM, Pádraig Brady wrote:
> diff --git a/tests/misc/ptx-overrun.sh b/tests/misc/ptx-overrun.sh

> +# Trigger an invalid heap reference noticed by gcc -fsanitize=address
> +# from coreutils-8.22 and earlier.  As well as an invalid memory reference,
> +# the issue can be seen in the output, with invalid whitespace trimming
> +# when multiple files are specified.
> +printf '%s\n' 'This is a ptx whitespace Trimming test' > ws.in
> +ptx ws.in ws.in | sort | uniq -u > out
> +compare /dev/null out || fail=1

Isn't this a user-visible change, i.e., worth a NEWS entry?
+1 otherwise.

BTW: I noticed that v8.21 produces a different result than v8.22:

  $ /tmp/cu/coreutils-8.21/src/ptx ws.in ws.in | sort | uniq -u
      test                               This is a ptx whitespace Trimming
     test                                This is a ptx whitespace Trimming
  $ /tmp/cu/coreutils-8.22/src/ptx ws.in ws.in | sort | uniq -u
          is a ptx whitespace Trimming   test                            This
          is a ptx whitespace Trimming   test                           This

... although there hasn't been a change in src/ptx.c - or I don't see it:
"git diff -r v8.21..v8.22 src/ptx.c" only shows a change in usage().
Any idea why?

Have a nice day,
Berny