mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
liblzma: Check for unexpected NULL pointers in block_header_decode().
The API docs gave an impression that such checks are done but they actually weren't done. In practice it made little difference since the calling code has a bug if these are NULL. Thanks to Jia Tan for the original patch that checked for block->filters == NULL.
This commit is contained in:
parent
ef315163ef
commit
7623b22d1d
1 changed files with 4 additions and 0 deletions
|
@ -39,6 +39,10 @@ lzma_block_header_decode(lzma_block *block,
|
|||
// are invalid or over 63 bits, or if the header is too small
|
||||
// to contain the claimed information.
|
||||
|
||||
// Catch unexpected NULL pointers.
|
||||
if (block == NULL || block->filters == NULL || in == NULL)
|
||||
return LZMA_PROG_ERROR;
|
||||
|
||||
// Initialize the filter options array. This way the caller can
|
||||
// safely free() the options even if an error occurs in this function.
|
||||
for (size_t i = 0; i <= LZMA_FILTERS_MAX; ++i) {
|
||||
|
|
Loading…
Reference in a new issue