aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-04-24 20:19:20 +0300
committerLasse Collin <lasse.collin@tukaani.org>2008-04-24 20:19:20 +0300
commit283f939974c32c47f05d495e8dea455ec646ed64 (patch)
treea6b84bbf52527e40967160b151f503b166db548a
parentSwitch to uint16_t as the type of range coder probabilities. (diff)
downloadxz-283f939974c32c47f05d495e8dea455ec646ed64.tar.xz
Added two assert()s.
-rw-r--r--src/liblzma/lzma/lzma_encoder.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/liblzma/lzma/lzma_encoder.c b/src/liblzma/lzma/lzma_encoder.c
index f7aec876..4eee84f3 100644
--- a/src/liblzma/lzma/lzma_encoder.c
+++ b/src/liblzma/lzma/lzma_encoder.c
@@ -71,7 +71,7 @@ do { \
#define length_encode(length_encoder, symbol, pos_state, update_price) \
do { \
- \
+ assert((symbol) <= MATCH_MAX_LEN); \
if ((symbol) < LEN_LOW_SYMBOLS) { \
bit_encode_0((length_encoder).choice); \
bittree_encode((length_encoder).low[pos_state], \
@@ -352,6 +352,8 @@ lzma_lzma_encode(lzma_coder *coder, uint8_t *restrict out,
if (coder->lz.sequence != SEQ_RUN
&& coder->lz.read_pos == coder->lz.write_pos
&& coder->additional_offset == 0) {
+ assert(coder->longest_match_was_found == false);
+
if (coder->lz.uncompressed_size == LZMA_VLI_VALUE_UNKNOWN
|| coder->lz.sequence == SEQ_FLUSH) {
// Write special marker: flush marker or end of payload