mirror of
https://git.savannah.gnu.org/git/tar.git
synced 2026-07-19 14:32:22 +00:00
67981bbb15
Problem reported by Antonio Teixeira. * src/list.c (read_header): When POSIX says a size field must be zero or does not represent a data count, treat it as zero. * tests/extrac32.at: Update to match new behavior. We now treat hard link sizes as zero even when the size fields are nonzero, and this means the “injected” file is treated as valid regardless of whether we list or extract. * tests/extrac34.at: New test. * tests/Makefile.am (TESTSUITE_AT), tests/testsuite.at: Add it.
41 lines
1.4 KiB
Plaintext
41 lines
1.4 KiB
Plaintext
# Check hard link with nonzero size field in tarball. -*- Autotest -*-
|
|
|
|
# Copyright 2026 Free Software Foundation, Inc.
|
|
|
|
# This file is part of GNU tar.
|
|
|
|
# GNU tar is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
|
|
# GNU tar is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# Check extracting from a nonconforming tarball that has
|
|
# a hard link with nonzero size.
|
|
|
|
AT_SETUP([hard link with a nonzero size field])
|
|
AT_KEYWORDS([extract extrac34 hard link])
|
|
AT_DATA([archive.in],
|
|
[/Td6WFoAAATm1rRGBMBwgFAhARwAAAAAAAAAAAbKrCjgJ/8AaF0AMIAzUBhoiawFdYeRen4lxlj0
|
|
QWRLpUM+28ArRsXVY5bGv4H5kijsqiJ4Z9YIVhZd01+IppF+AkltS60aB8fuUW35Tp/3XzUx9Mq2
|
|
4ypJFzvcgHXsSIvc9L+mmTDuHzhvJQ/oe7ya8QAASbOfD7CgZcIAAYwBgFAAAEWxohaxxGf7AgAA
|
|
AAAEWVo=
|
|
])
|
|
AT_CHECK([base64 --help >/dev/null 2>&1 || AT_SKIP_TEST
|
|
xz --help >/dev/null 2>&1 || AT_SKIP_TEST
|
|
base64 -d < archive.in | xz -c -d > archive.tar
|
|
])
|
|
AT_CHECK([mkdir dir
|
|
])
|
|
AT_CHECK([tar -C dir -xf archive.tar || exit 1
|
|
cmp dir/a dir/b
|
|
])
|
|
AT_CLEANUP
|