X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Flzms-decompress.c;fp=src%2Flzms-decompress.c;h=7254091449c052442bae510444f93d7f92b9a9d0;hb=737676a62120667d39b5a00efc5b3e84624fa744;hp=f8bfcdb17344b3055d343e7be7615897484d7bfc;hpb=9ca5c20853d3be06378fb985aa75c75df280d1e2;p=wimlib diff --git a/src/lzms-decompress.c b/src/lzms-decompress.c index f8bfcdb1..72540914 100644 --- a/src/lzms-decompress.c +++ b/src/lzms-decompress.c @@ -1012,16 +1012,6 @@ lzms_decompress(const void *compressed_data, size_t compressed_size, if (uncompressed_size == 0) return 0; - /* The x86 post-processor requires that the uncompressed length fit into - * a signed 32-bit integer. Also, the position slot table cannot be - * searched for a position of INT32_MAX or greater. */ - if (uncompressed_size >= INT32_MAX) { - LZMS_DEBUG("Uncompressed length too large " - "(got %zu, expected < INT32_MAX)", - uncompressed_size); - return -1; - } - /* Decode the literals and matches. */ if (lzms_decode_items(compressed_data, compressed_size, uncompressed_data, uncompressed_size, ctx)) @@ -1048,6 +1038,12 @@ lzms_create_decompressor(size_t max_block_size, void **ctx_ret) { struct lzms_decompressor *ctx; + /* The x86 post-processor requires that the uncompressed length fit into + * a signed 32-bit integer. Also, the position slot table cannot be + * searched for a position of INT32_MAX or greater. */ + if (max_block_size >= INT32_MAX) + return WIMLIB_ERR_INVALID_PARAM; + ctx = ALIGNED_MALLOC(sizeof(struct lzms_decompressor), DECODE_TABLE_ALIGNMENT); if (ctx == NULL)