#1063529 wdiff: broken when the input contains a null character

Package:
wdiff
Source:
wdiff
Description:
Compares two files word by word
Submitter:
Vincent Lefevre
Date:
2024-02-09 13:24:04 UTC
Severity:
normal
#1063529#5
Date:
2024-02-09 13:21:16 UTC
From:
To:
wdiff is broken when the input contains a null character.
For instance, create 2 files a and b with

  printf "a\n2\n3\n4\n5\n6\n7\n8\n" > a
  printf "b\n2\n3\n4\n5\n6\n7\n8\n\000\n" > b

$ wdiff a b
b
2
3
4
5
6
7
8

instead of something like

[-a-]{+b+}
2
3
4
5
6
7
8
{+^@+}

Similarly, the following is incorrect:

$ diff -au a b | wdiff -d
++ b    2024-02-09 14:11:23.981863795 +0100
@@ -1,4 +1,4 @@
b
2
3
4
@@ -6,3 +6,4 @@
6
7
8

There is no such issue if I replace \000 by \001.
So this is specific to the null character.