1
0
Fork 0

Merging upstream version 1.13.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-17 22:30:27 +01:00
parent 36ad19c82c
commit 67eaf3906f
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
17 changed files with 370 additions and 277 deletions

9
lzip.h
View file

@ -1,5 +1,5 @@
/* Lunzip - Decompressor for the lzip format
Copyright (C) 2010-2021 Antonio Diaz Diaz.
Copyright (C) 2010-2022 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
@ -131,6 +131,7 @@ static inline void CRC32_init( void )
}
}
/* about as fast as it is possible without messing with endianness */
static inline void CRC32_update_buf( uint32_t * const crc,
const uint8_t * const buffer,
const int size )
@ -228,12 +229,12 @@ static inline bool Lt_verify_consistency( const Lzip_trailer data )
{
const unsigned crc = Lt_get_data_crc( data );
const unsigned long long dsize = Lt_get_data_size( data );
const unsigned long long msize = Lt_get_member_size( data );
const unsigned long long mlimit = ( 9 * dsize + 7 ) / 8 + min_member_size;
const unsigned long long dlimit = 7090 * ( msize - 26 ) - 1;
if( ( crc == 0 ) != ( dsize == 0 ) ) return false;
const unsigned long long msize = Lt_get_member_size( data );
if( msize < min_member_size ) return false;
const unsigned long long mlimit = ( 9 * dsize + 7 ) / 8 + min_member_size;
if( mlimit > dsize && msize > mlimit ) return false;
const unsigned long long dlimit = 7090 * ( msize - 26 ) - 1;
if( dlimit > msize && dsize > dlimit ) return false;
return true;
}