]> granicus.if.org Git - xz/commitdiff
LZ decoder cleanup
authorLasse Collin <lasse.collin@tukaani.org>
Sat, 13 Sep 2008 10:54:00 +0000 (13:54 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Sat, 13 Sep 2008 10:54:00 +0000 (13:54 +0300)
src/liblzma/lz/lz_decoder.c

index 0344ae6ad5adb3646f45c70feece74d69dd17ed7..d4bd59f2b0db931e3a5fbc98a33030ca3f01c602 100644 (file)
@@ -219,12 +219,11 @@ lzma_lz_decoder_init(lzma_next_coder *next, lzma_allocator *allocator,
        // dictionary to the output buffer, since applications are
        // recommended to give aligned buffers to liblzma.
        //
-       // Avoid integer overflow. FIXME Should the return value be
-       // LZMA_OPTIONS_ERROR or LZMA_MEM_ERROR?
+       // Avoid integer overflow.
        if (dict_size > SIZE_MAX - 15)
                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.
        if (next->coder->dict.size != dict_size) {