]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
liblzma: Rename a variable and improve a comment.
authorLasse Collin <lasse.collin@tukaani.org>
Thu, 14 Jul 2022 15:12:38 +0000 (18:12 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Sun, 24 Jul 2022 08:37:44 +0000 (11:37 +0300)
src/liblzma/lzma/lzma_decoder.c

index 140a44f19ccdb985a2b981478dacc908bb85a25d..f56ccaf77fd3a3f1a342bf190cb6794e11fd0170 100644 (file)
@@ -348,9 +348,14 @@ lzma_decode(void *coder_ptr, lzma_dict *restrict dictptr,
 
        lzma_ret ret = LZMA_OK;
 
+       // This is true when the next LZMA symbol is allowed to be EOPM.
+       // That is, if this is false, then EOPM is considered
+       // an invalid symbol and we will return LZMA_DATA_ERROR.
+       //
        // EOPM is always required (not just allowed) when
-       // the uncompressed size isn't known.
-       bool eopm_allowed = coder->uncompressed_size == LZMA_VLI_UNKNOWN;
+       // the uncompressed size isn't known. When uncompressed size
+       // is known, eopm_is_valid may be set to true later.
+       bool eopm_is_valid = coder->uncompressed_size == LZMA_VLI_UNKNOWN;
 
        // If uncompressed size is known and there is enough output space
        // to decode all the data, limit the available buffer space so that
@@ -397,7 +402,7 @@ lzma_decode(void *coder_ptr, lzma_dict *restrict dictptr,
 
                        // Otherwise continue decoding with the expectation
                        // that the next LZMA symbol is EOPM.
-                       eopm_allowed = true;
+                       eopm_is_valid = true;
                }
 
                rc_if_0(coder->is_match[state][pos_state], SEQ_IS_MATCH) {
@@ -705,7 +710,7 @@ lzma_decode(void *coder_ptr, lzma_dict *restrict dictptr,
                                                //     that EOPM might be used
                                                //     (it's not allowed in
                                                //     LZMA2).
-                                               if (!eopm_allowed) {
+                                               if (!eopm_is_valid) {
                                                        ret = LZMA_DATA_ERROR;
                                                        goto out;
                                                }