]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
liblzma: Add NULL check to lzma_index_hash_append.
authorJia Tan <jiat0218@gmail.com>
Wed, 17 Aug 2022 12:20:16 +0000 (20:20 +0800)
committerLasse Collin <lasse.collin@tukaani.org>
Mon, 9 Jan 2023 14:34:32 +0000 (16:34 +0200)
This is for consistency with lzma_index_append.

src/liblzma/common/index_hash.c

index c3c5667468ee547a1e6edd55960d7108ba0f7e03..f55f7bc8ff8f24de7508ff8a3b999fc5b258e9dc 100644 (file)
@@ -145,7 +145,7 @@ lzma_index_hash_append(lzma_index_hash *index_hash, lzma_vli unpadded_size,
                lzma_vli uncompressed_size)
 {
        // Validate the arguments.
-       if (index_hash->sequence != SEQ_BLOCK
+       if (index_hash == NULL || index_hash->sequence != SEQ_BLOCK
                        || unpadded_size < UNPADDED_SIZE_MIN
                        || unpadded_size > UNPADDED_SIZE_MAX
                        || uncompressed_size > LZMA_VLI_MAX)