mirror of
https://https.git.savannah.gnu.org/git/diffutils.git
synced 2026-01-27 18:04:32 +00:00
Problem reported by Gisle Vanem <https://bugs.gnu.org/64316>. * src/io.c (find_and_hash_each_line): Rely on xpalloc to check for integer overflow instead of trying to do it ourselves incorrectly, with old code that predated the use of xpalloc. * src/system.h: Verify that LIN_MAX == IDX_MAX, since the code now relies on this. * tests/Makefile.am (TESTS): Add bug-64316. * tests/bug-64316: New file
32 lines
580 B
Bash
Executable File
32 lines
580 B
Bash
Executable File
#!/bin/sh
|
|
# Test for signed integer overflow bug within diff.
|
|
# Bug reported by Gisele Vanem <http://bugs.gnu.org/64316>.
|
|
# Compile with gcc -fsanitize=undefined to test for this bug.
|
|
|
|
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
|
|
|
fail=0
|
|
|
|
for f in a b; do
|
|
printf 'c\nd\ne\nf\ng\n%s\nh\ni\nj\nk\nl\n' $f >$f || framework_failure_
|
|
done
|
|
|
|
cat >exp <<'EOF' || framework_failure_
|
|
@@ -3,7 +3,7 @@
|
|
e
|
|
f
|
|
g
|
|
-a
|
|
+b
|
|
h
|
|
i
|
|
j
|
|
EOF
|
|
|
|
returns_ 1 diff -u a b >out 2>err || fail=1
|
|
sed '1,2d' out >out1 || framework_failure_
|
|
compare exp out1 || fail=1
|
|
compare /dev/null err || fail=1
|
|
|
|
Exit $fail
|