[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#686502: pxz produces archives broken for busybox's unxz



On Sat, Dec 22, 2012 at 12:03:31AM +0100, Abou Al Montacir wrote:
> --- busybox-1.20.0/debian/patches/fix-unxz-with-multiple-streams.patch	1970-01-01 01:00:00.000000000 +0100
> +++ busybox-1.20.0/debian/patches/fix-unxz-with-multiple-streams.patch	2012-12-21 19:23:12.000000000 +0100
> @@ -0,0 +1,25 @@
> +Author: Abou Al Montacir <abou.almontacir@sfr.fr>
> +Purpose: Fix decompression of multi stream XZ compressed files
> + (Closes: bug#686502)
> +
> +--- busybox-1.20.0~/archival/libarchive/decompress_unxz.c	2012-12-20 21:51:04.000000000 +0100
> ++++ busybox-1.20.0/archival/libarchive/decompress_unxz.c	2012-12-20 21:49:11.000000000 +0100
> +@@ -87,7 +87,17 @@ unpack_xz_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd)
> + 			iobuf.out_pos = 0;
> + 		}
> + 		if (r == XZ_STREAM_END) {
> +-			break;
> ++			if (iobuf.in_pos != iobuf.in_size) {
> ++				// Initialize decoder for new stream
> ++				xz_dec_end(state);
> ++				state = xz_dec_init(XZ_DYNALLOC, 64*1024*1024);

Why can't you use the existing call somewhere at the beginning? If I
remember correctly, you need 128*1024*1024 to decompress all valid
files.

> ++				// Eat padding
> ++				while (iobuf.in[iobuf.in_pos] == 0){
> ++					iobuf.in_pos += 1;
> ++				}

Padding is a multiple of _four_ bytes. Did you read the spec?

> ++			}
> ++			// Look for other streams
> ++			continue;

Does it bail out if there is no new stream?

Bastian

-- 
Men will always be men -- no matter where they are.
		-- Harry Mudd, "Mudd's Women", stardate 1329.8


Reply to: