summaryrefslogtreecommitdiffstats
path: root/fast_encoder.h
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 10:05:19 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 10:05:19 +0000
commitda3d07857e8877d884705832c5fd038f3e44751f (patch)
treeb5610da37ed6a9f39b1e2835b3482686cc0e0cdb /fast_encoder.h
parentAdding debian version 1.16~rc1-1. (diff)
downloadlzip-da3d07857e8877d884705832c5fd038f3e44751f.tar.xz
lzip-da3d07857e8877d884705832c5fd038f3e44751f.zip
Merging upstream version 1.16.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'fast_encoder.h')
-rw-r--r--fast_encoder.h14
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();
}
}