mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
Add more sanity checks to lzma_stream_buffer_decode().
This commit is contained in:
parent
c129748675
commit
5fb34d8324
1 changed files with 7 additions and 0 deletions
|
@ -26,6 +26,13 @@ lzma_stream_buffer_decode(uint64_t *memlimit, uint32_t flags,
|
|||
const uint8_t *in, size_t *in_pos, size_t in_size,
|
||||
uint8_t *out, size_t *out_pos, size_t out_size)
|
||||
{
|
||||
// Sanity checks
|
||||
if (in_pos == NULL || (in == NULL && *in_pos != in_size)
|
||||
|| *in_pos > in_size || out_pos == NULL
|
||||
|| (out == NULL && *out_pos != out_size)
|
||||
|| *out_pos > out_size)
|
||||
return LZMA_PROG_ERROR;
|
||||
|
||||
// Catch flags that are not allowed in buffer-to-buffer decoding.
|
||||
if (flags & LZMA_TELL_ANY_CHECK)
|
||||
return LZMA_PROG_ERROR;
|
||||
|
|
Loading…
Reference in a new issue