mirror of https://git.tukaani.org/xz.git
liblzma: Fix lzma_index_dup() for empty Streams.
Stream Flags and Stream Padding weren't copied from empty Streams.
This commit is contained in:
parent
09f395b6b3
commit
21515d79d7
|
@ -872,11 +872,8 @@ index_dup_stream(const index_stream *src, const lzma_allocator *allocator)
|
||||||
index_stream *dest = index_stream_init(src->node.compressed_base,
|
index_stream *dest = index_stream_init(src->node.compressed_base,
|
||||||
src->node.uncompressed_base, src->number,
|
src->node.uncompressed_base, src->number,
|
||||||
src->block_number_base, allocator);
|
src->block_number_base, allocator);
|
||||||
|
if (dest == NULL)
|
||||||
// Return immediately if allocation failed or if there are
|
return NULL;
|
||||||
// no groups to duplicate.
|
|
||||||
if (dest == NULL || src->groups.leftmost == NULL)
|
|
||||||
return dest;
|
|
||||||
|
|
||||||
// Copy the overall information.
|
// Copy the overall information.
|
||||||
dest->record_count = src->record_count;
|
dest->record_count = src->record_count;
|
||||||
|
@ -884,6 +881,10 @@ index_dup_stream(const index_stream *src, const lzma_allocator *allocator)
|
||||||
dest->stream_flags = src->stream_flags;
|
dest->stream_flags = src->stream_flags;
|
||||||
dest->stream_padding = src->stream_padding;
|
dest->stream_padding = src->stream_padding;
|
||||||
|
|
||||||
|
// Return if there are no groups to duplicate.
|
||||||
|
if (src->groups.leftmost == NULL)
|
||||||
|
return dest;
|
||||||
|
|
||||||
// Allocate memory for the Records. We put all the Records into
|
// Allocate memory for the Records. We put all the Records into
|
||||||
// a single group. It's simplest and also tends to make
|
// a single group. It's simplest and also tends to make
|
||||||
// lzma_index_locate() a little bit faster with very big Indexes.
|
// lzma_index_locate() a little bit faster with very big Indexes.
|
||||||
|
|
Loading…
Reference in New Issue