1
0
mirror of https://git.tukaani.org/xz.git synced 2026-10-31 03:14:56 +00:00

Tests: Test that integer overflow in xz --list totals is caught

This commit is contained in:
Lasse Collin 2026-08-15 19:50:05 +03:00
parent 490ca91153
commit 7f539d1448
No known key found for this signature in database
GPG Key ID: 38EE757D69184620

View File

@ -130,6 +130,21 @@ if test -n "$XZ" && "$XZ" -l "$I" > /dev/null 2>&1; then
exit 1 exit 1
fi fi
# Test that integer overflow in --list totals is caught.
# It should succeed when the file is passed twice to xz -l and
# fail when passed thrice.
I="$srcdir/files/bad-1-index-huge-uncomp.xz"
if test -n "$XZ" && "$XZ" -l "$I" "$I" > /dev/null 2>&1; then
:
else
echo "xz -l unexpectedly failed when the file was used twice: $I"
exit 1
fi
if test -n "$XZ" && "$XZ" -l "$I" "$I" "$I" > /dev/null 2>&1; then
echo "xz -l unexpectedly succeeded when the file was used thrice: $I"
exit 1
fi
for I in "$srcdir"/files/unsupported-*.xz for I in "$srcdir"/files/unsupported-*.xz
do do
# Test these only with xz as unsupported-check.xz will exit # Test these only with xz as unsupported-check.xz will exit