diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 10:05:13 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 10:05:13 +0000 |
commit | f9017027ecdfd732b688165216c6250b7ec2f128 (patch) | |
tree | a939a32082b56a038a35a5f63342294c6a723f88 /fast_encoder.h | |
parent | Adding upstream version 1.16~rc1. (diff) | |
download | lzip-f9017027ecdfd732b688165216c6250b7ec2f128.tar.xz lzip-f9017027ecdfd732b688165216c6250b7ec2f128.zip |
Adding upstream version 1.16.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'fast_encoder.h')
-rw-r--r-- | fast_encoder.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/fast_encoder.h b/fast_encoder.h index e968f64..e37ad7f 100644 --- a/fast_encoder.h +++ b/fast_encoder.h @@ -1,6 +1,5 @@ /* Lzip - LZMA lossless data compressor - Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014 - Antonio Diaz Diaz. + Copyright (C) 2008-2014 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 @@ -50,10 +49,13 @@ public: { while( --n >= 0 ) { - key4 = ( ( key4 << 4 ) ^ buffer[pos+3] ) & key4_mask; - const int newpos = prev_positions[key4]; - prev_positions[key4] = pos + 1; - pos_array[cyclic_pos] = newpos; + if( available_bytes() >= 4 ) + { + key4 = ( ( key4 << 4 ) ^ buffer[pos+3] ) & key4_mask; + const int newpos = prev_positions[key4]; + prev_positions[key4] = pos + 1; + pos_array[cyclic_pos] = newpos; + } move_pos(); } } |