LZ decoder cleanup
This commit is contained in:
parent
13a74b78e3
commit
13d68b0698
|
@ -219,12 +219,11 @@ lzma_lz_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
|
||||||
// dictionary to the output buffer, since applications are
|
// dictionary to the output buffer, since applications are
|
||||||
// recommended to give aligned buffers to liblzma.
|
// recommended to give aligned buffers to liblzma.
|
||||||
//
|
//
|
||||||
// Avoid integer overflow. FIXME Should the return value be
|
// Avoid integer overflow.
|
||||||
// LZMA_OPTIONS_ERROR or LZMA_MEM_ERROR?
|
|
||||||
if (dict_size > SIZE_MAX - 15)
|
if (dict_size > SIZE_MAX - 15)
|
||||||
return LZMA_MEM_ERROR;
|
return LZMA_MEM_ERROR;
|
||||||
|
|
||||||
dict_size = (dict_size + 15) & (SIZE_MAX - 15);
|
dict_size = (dict_size + 15) & ~((size_t)(15));
|
||||||
|
|
||||||
// Allocate and initialize the dictionary.
|
// Allocate and initialize the dictionary.
|
||||||
if (next->coder->dict.size != dict_size) {
|
if (next->coder->dict.size != dict_size) {
|
||||||
|
|
Loading…
Reference in New Issue