From 66e9e9975a499d2c247d482cc47d98bcf878b3c8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 23 Jan 2024 06:08:15 +0100 Subject: Adding upstream version 0.25. Signed-off-by: Daniel Baumann --- archive_reader.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'archive_reader.cc') diff --git a/archive_reader.cc b/archive_reader.cc index 8ad315d..c4438ae 100644 --- a/archive_reader.cc +++ b/archive_reader.cc @@ -1,5 +1,5 @@ /* Tarlz - Archiver with multimember lzip compression - Copyright (C) 2013-2022 Antonio Diaz Diaz. + Copyright (C) 2013-2024 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -76,7 +76,7 @@ void xLZ_decompress_write( LZ_Decoder * const decoder, Archive_descriptor::Archive_descriptor( const std::string & archive_name ) : name( archive_name ), namep( name.empty() ? "(stdin)" : name.c_str() ), infd( non_tty_infd( archive_name, namep ) ), - lzip_index( infd, true, false ), + lzip_index( infd ), seekable( lseek( infd, 0, SEEK_SET ) == 0 ), indexed( seekable && lzip_index.retval() == 0 ) {} @@ -90,7 +90,7 @@ int Archive_reader_base::parse_records( Extended & extended, const long long edsize = parse_octal( header + size_o, size_l ); const long long bufsize = round_up( edsize ); if( edsize <= 0 ) return err( 2, misrec_msg ); // no extended records - if( edsize >= 1LL << 33 || bufsize >= INT_MAX ) + if( edsize >= 1LL << 33 || bufsize > max_edata_size ) return err( -2, longrec_msg ); // records too long if( !rbuf.resize( bufsize ) ) return err( -1, mem_msg ); e_msg_ = ""; e_code_ = 0; @@ -116,10 +116,10 @@ int Archive_reader::read( uint8_t * const buf, const int size ) const int rd = readblock( ad.infd, buf, size ); if( rd != size && errno ) return err( -1, rdaerr_msg, errno, rd ); const Lzip_header & header = (*(const Lzip_header *)buf); - const bool islz = ( rd >= min_member_size && header.verify_magic() && - header.verify_version() && + const bool islz = ( rd >= min_member_size && header.check_magic() && + header.check_version() && isvalid_ds( header.dictionary_size() ) ); - const bool istar = ( rd == size && verify_ustar_chksum( buf ) ); + const bool istar = ( rd == size && check_ustar_chksum( buf ) ); const bool iseoa = ( !islz && !istar && rd == size && block_is_zero( buf, size ) ); bool maybe_lz = islz; // maybe corrupt tar.lz @@ -139,7 +139,7 @@ int Archive_reader::read( uint8_t * const buf, const int size ) { LZ_decompress_close( decoder ); decoder = 0; return err( -1, mem_msg ); } xLZ_decompress_write( decoder, buf, rd ); const int ret = read( buf, size ); if( ret != 0 ) return ret; - if( verify_ustar_chksum( buf ) || block_is_zero( buf, size ) ) return 0; + if( check_ustar_chksum( buf ) || block_is_zero( buf, size ) ) return 0; return err( 2, islz ? posix_lz_msg : "" ); } -- cgit v1.2.3