aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/lzma/liblzma/common/index_decoder.c
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.com>2024-05-31 19:32:06 +0300
committerthegeorg <thegeorg@yandex-team.com>2024-05-31 19:42:52 +0300
commit0d2f4a9edd041501cbbd09a76ade7a4b977e86af (patch)
treebfb9bf4e74848360f403ccd2d4f28431e020c1a9 /contrib/libs/lzma/liblzma/common/index_decoder.c
parent01178e24a1066fe3335a0b1442d1017ca82f1a0c (diff)
downloadydb-0d2f4a9edd041501cbbd09a76ade7a4b977e86af.tar.gz
Update contrib/libs/lzma to 5.6.2
Keep "Update contrib/libs/lzma to 5.6.1" as an independent commit. 0cb9e331dfdcd6329e9a8211b4b89e280df9aa03
Diffstat (limited to 'contrib/libs/lzma/liblzma/common/index_decoder.c')
-rw-r--r--contrib/libs/lzma/liblzma/common/index_decoder.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/contrib/libs/lzma/liblzma/common/index_decoder.c b/contrib/libs/lzma/liblzma/common/index_decoder.c
index 19a31b3e94..4bcb306921 100644
--- a/contrib/libs/lzma/liblzma/common/index_decoder.c
+++ b/contrib/libs/lzma/liblzma/common/index_decoder.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: 0BSD
+
///////////////////////////////////////////////////////////////////////////////
//
/// \file index_decoder.c
@@ -5,9 +7,6 @@
//
// Author: Lasse Collin
//
-// This file has been put into the public domain.
-// You can do whatever you want with this file.
-//
///////////////////////////////////////////////////////////////////////////////
#include "index_decoder.h"
@@ -306,6 +305,12 @@ lzma_index_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
extern LZMA_API(lzma_ret)
lzma_index_decoder(lzma_stream *strm, lzma_index **i, uint64_t memlimit)
{
+ // If i isn't NULL, *i must always be initialized due to
+ // the wording in the API docs. This way it is initialized
+ // if we return LZMA_PROG_ERROR due to strm == NULL.
+ if (i != NULL)
+ *i = NULL;
+
lzma_next_strm_init(lzma_index_decoder_init, strm, i, memlimit);
strm->internal->supported_actions[LZMA_RUN] = true;
@@ -320,6 +325,11 @@ lzma_index_buffer_decode(lzma_index **i, uint64_t *memlimit,
const lzma_allocator *allocator,
const uint8_t *in, size_t *in_pos, size_t in_size)
{
+ // If i isn't NULL, *i must always be initialized due to
+ // the wording in the API docs.
+ if (i != NULL)
+ *i = NULL;
+
// Sanity checks
if (i == NULL || memlimit == NULL
|| in == NULL || in_pos == NULL || *in_pos > in_size)