diff options
author | jiat75 <jiat0218@gmail.com> | 2022-01-28 20:47:55 +0800 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2022-07-12 19:03:51 +0300 |
commit | e20ce2b12251a246c50fb5b7fa2204c11611b407 (patch) | |
tree | 11801cefdf9ef9c653395fb9e7983a752d1a3ea6 /src/liblzma/lzma/lzma_encoder.c | |
parent | CMake: Keep compatible with Windows 95 for 32-bit build. (diff) | |
download | xz-e20ce2b12251a246c50fb5b7fa2204c11611b407.tar.xz |
liblzma: Add NULL checks to LZMA and LZMA2 properties encoders.
Previously lzma_lzma_props_encode() and lzma_lzma2_props_encode()
assumed that the options pointers must be non-NULL because the
with these filters the API says it must never be NULL. It is
good to do these checks anyway.
Diffstat (limited to 'src/liblzma/lzma/lzma_encoder.c')
-rw-r--r-- | src/liblzma/lzma/lzma_encoder.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/liblzma/lzma/lzma_encoder.c b/src/liblzma/lzma/lzma_encoder.c index 07d2b87b..c1552f19 100644 --- a/src/liblzma/lzma/lzma_encoder.c +++ b/src/liblzma/lzma/lzma_encoder.c @@ -658,6 +658,9 @@ lzma_lzma_lclppb_encode(const lzma_options_lzma *options, uint8_t *byte) extern lzma_ret lzma_lzma_props_encode(const void *options, uint8_t *out) { + if (options == NULL) + return LZMA_PROG_ERROR; + const lzma_options_lzma *const opt = options; if (lzma_lzma_lclppb_encode(opt, out)) |