summaryrefslogtreecommitdiffstats
path: root/lzip.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-02-21 12:25:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-02-21 12:25:28 +0000
commite5389ef44a4a53f0694c75c4e3d2b9e64ac3ab2c (patch)
treed35b6bb5cadbc2a260a65bc4ad2806b60d93489d /lzip.h
parentAdding upstream version 1.12. (diff)
downloadclzip-e5389ef44a4a53f0694c75c4e3d2b9e64ac3ab2c.tar.xz
clzip-e5389ef44a4a53f0694c75c4e3d2b9e64ac3ab2c.zip
Adding upstream version 1.13.upstream/1.13
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--lzip.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/lzip.h b/lzip.h
index 88f69ca..9d4639e 100644
--- a/lzip.h
+++ b/lzip.h
@@ -1,5 +1,5 @@
/* Clzip - LZMA lossless data compressor
- 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
@@ -136,6 +136,7 @@ static inline void CRC32_init( void )
static inline void CRC32_update_byte( uint32_t * const crc, const uint8_t byte )
{ *crc = crc32[(*crc^byte)&0xFF] ^ ( *crc >> 8 ); }
+/* 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 )
@@ -269,12 +270,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;
}