diff options
Diffstat (limited to '')
-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(); } } |