1
0
Fork 0

Adding upstream version 0.15.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-17 21:13:34 +01:00
parent be936e5cc3
commit 5d67ab9e97
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
51 changed files with 1255 additions and 507 deletions

View file

@ -64,7 +64,7 @@ unsigned long long parse_decimal( const char * const ptr,
{
const unsigned long long prev = result;
result *= 10; result += ptr[i] - '0';
if( result < prev || result > LLONG_MAX ) // overflow
if( result < prev || result > max_file_size ) // overflow
{ if( tailp ) *tailp = ptr; return 0; }
}
if( tailp ) *tailp = ptr + i;
@ -219,7 +219,7 @@ bool Extended::parse( const char * const buf, const unsigned long long edsize,
if( file_size_ != 0 && !permissive ) return false;
file_size_ = parse_decimal( tail + 5, &tail, rest - 5 );
// parse error or size fits in ustar header
if( file_size_ < 1ULL << 33 || tail != buf + ( pos + rsize - 1 ) )
if( file_size_ < 1LL << 33 || tail != buf + ( pos + rsize - 1 ) )
return false;
}
else if( rest > 10 && std::memcmp( tail, "GNU.crc32=", 10 ) == 0 )
@ -281,9 +281,9 @@ void Extended::fill_from_ustar( const Tar_header header )
/* Returns file size from record or from ustar header, and resets file_size_.
Used for fast parsing of headers in uncompressed archives. */
unsigned long long Extended::get_file_size_and_reset( const Tar_header header )
long long Extended::get_file_size_and_reset( const Tar_header header )
{
const unsigned long long tmp = file_size_;
const long long tmp = file_size_;
file_size( 0 );
const Typeflag typeflag = (Typeflag)header[typeflag_o];
if( typeflag == tf_regular || typeflag == tf_hiperf )