# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../xz/xz-5.0.3-upstream-git-fixes-20110809.patch # Copyright (C) 2011 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- SDE-COPYRIGHT-NOTE-END --- Description: Bugfixes from upstream git repository This patch includes bugfixes cherry-picked from the upstream git repository. refererence: http://git.tukaani.org/?p=xz.git From 240e8b9791df597063a3b68d04ffcb3aa4f2de6a Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Mon, 23 May 2011 18:30:30 +0300 Subject: [PATCH] Build: Set GZIP_ENV=-9n in top-level Makefile.am. --- Makefile.am | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2ce74aa..1e7ba61 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,6 +5,9 @@ ## You can do whatever you want with this file. ## +# Use -n to prevent gzip from adding a timestamp to the .gz headers. +GZIP_ENV = -9n + DIST_SUBDIRS = lib src po tests debug SUBDIRS = -- 1.7.2.3 From 844f84fcad9670c543550edf7c7e42630c8f7715 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Fri, 27 May 2011 22:09:49 +0300 Subject: [PATCH] liblzma: Handle allocation failures correctly in lzma_index_init(). Thanks to Jim Meyering. --- src/liblzma/common/index.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/liblzma/common/index.c b/src/liblzma/common/index.c index ddb9d36..9af4bc1 100644 --- a/src/liblzma/common/index.c +++ b/src/liblzma/common/index.c @@ -398,10 +398,13 @@ extern LZMA_API(lzma_index *) lzma_index_init(lzma_allocator *allocator) { lzma_index *i = index_init_plain(allocator); + if (i == NULL) + return NULL; + index_stream *s = index_stream_init(0, 0, 1, 0, allocator); - if (i == NULL || s == NULL) { - index_stream_end(s, allocator); + if (s == NULL) { lzma_free(i, allocator); + return NULL; } index_tree_append(&i->streams, &s->node); -- 1.7.2.3 From 6c4d4db2bc8d8b682bd927144d37daa2ab21a6d6 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Fri, 27 May 2011 22:25:44 +0300 Subject: [PATCH] xz: Fix error handling in xz -lvv. It could do an invalid free() and read past the end of the uninitialized filters array. --- src/xz/list.c | 21 ++++++--------------- 1 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/xz/list.c b/src/xz/list.c index 1c93718..98307eb 100644 --- a/src/xz/list.c +++ b/src/xz/list.c @@ -382,14 +382,9 @@ parse_block_header(file_pair *pair, const lzma_index_iter *iter, if (buf.u8[0] == 0) goto data_error; - lzma_block block; - lzma_filter filters[LZMA_FILTERS_MAX + 1]; - - // Initialize the pointers so that they can be passed to free(). - for (size_t i = 0; i < ARRAY_SIZE(filters); ++i) - filters[i].options = NULL; - // Initialize the block structure and decode Block Header Size. + lzma_filter filters[LZMA_FILTERS_MAX + 1]; + lzma_block block; block.version = 0; block.check = iter->stream.flags->check; block.filters = filters; @@ -437,6 +432,10 @@ parse_block_header(file_pair *pair, const lzma_index_iter *iter, break; case LZMA_DATA_ERROR: + // Free the memory allocated by lzma_block_header_decode(). + for (size_t i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i) + free(filters[i].options); + goto data_error; default: @@ -466,14 +465,6 @@ data_error: // Show the error message. message_error("%s: %s", pair->src_name, message_strm(LZMA_DATA_ERROR)); - - // Free the memory allocated by lzma_block_header_decode(). - // This is truly needed only if we get here after a succcessful - // call to lzma_block_header_decode() but it doesn't hurt to - // always do it. - for (size_t i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i) - free(filters[i].options); - return true; } -- 1.7.2.3 From 631f4d3ae6adfda84d1a110781d9402c12e16cfc Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Sat, 28 May 2011 16:43:26 +0300 Subject: [PATCH] Don't call close(-1) in tuklib_open_stdxxx() on error. Thanks to Jim Meyering. --- src/common/tuklib_open_stdxxx.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/common/tuklib_open_stdxxx.c b/src/common/tuklib_open_stdxxx.c index 08bc60d..26702a6 100644 --- a/src/common/tuklib_open_stdxxx.c +++ b/src/common/tuklib_open_stdxxx.c @@ -39,12 +39,14 @@ tuklib_open_stdxxx(int err_status) | (i == 0 ? O_WRONLY : O_RDONLY)); if (fd != i) { + if (fd != -1) + (void)close(fd); + // Something went wrong. Exit with the // exit status we were given. Don't try // to print an error message, since stderr // may very well be non-existent. This // error should be extremely rare. - (void)close(fd); exit(err_status); } } -- 1.7.2.3 From 7fcc6334ea8923550ba6b5347ff99dc8432234b0 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Thu, 16 Jun 2011 12:15:29 +0300 Subject: [PATCH] liblzma: Remove unneeded semicolon. --- src/liblzma/lz/lz_encoder_hash.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/liblzma/lz/lz_encoder_hash.h b/src/liblzma/lz/lz_encoder_hash.h index c398d7d..342a333 100644 --- a/src/liblzma/lz/lz_encoder_hash.h +++ b/src/liblzma/lz/lz_encoder_hash.h @@ -39,7 +39,7 @@ // Endianness doesn't matter in hash_2_calc() (no effect on the output). #ifdef TUKLIB_FAST_UNALIGNED_ACCESS # define hash_2_calc() \ - const uint32_t hash_value = *(const uint16_t *)(cur); + const uint32_t hash_value = *(const uint16_t *)(cur) #else # define hash_2_calc() \ const uint32_t hash_value \ -- 1.7.2.3