If lzma_index_append() failed (most likely memory allocation failure)
it could have gone unnoticed and the resulting .xz file would have
an incorrect Index. Decompressing such a file would produce the
correct uncompressed data but then an error would occur when
verifying the Index field.
ret = lzma_index_append(coder->index,
allocator, unpadded_size,
uncompressed_size);
+ if (ret != LZMA_OK) {
+ threads_stop(coder, false);
+ return ret;
+ }
// If we didn't fill the output buffer yet,
// try to read more data. Maybe the next
}
if (ret != LZMA_OK) {
- // coder->thread_error was set or
- // lzma_index_append() failed.
+ // coder->thread_error was set.
threads_stop(coder, false);
return ret;
}