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

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



On Sun, 2013-01-06 at 23:32 +0100, Bastian Blank wrote:
> On Thu, Dec 27, 2012 at 10:08:07PM +0100, Abou Al Montacir wrote:
> > +		if (r == XZ_STREAM_END) {
> > +			/* Eat padding. Stream never starts with zeros, and padding is 32 aligned */
> > +			while ((iobuf.in_pos < iobuf.in_size) && (iobuf.in[iobuf.in_pos] == 0)) {
> > +					iobuf.in_pos += 1;
> > +			}
> > +			/* Reached end of buffer. Fill it again from stream */
> > +			if (iobuf.in_pos == iobuf.in_size) {
> > +				continue;
> > +			}
> > +			if(iobuf.in_pos % 4){
> 
> Are you sure this is correct? in_pos is the position in tht buffer, not
> the file. Also look out for coding style.

Provided the buffer size is multiple of 4 bytes, which is the case for
BUFSIZ. Of course one can decide to use a mis aligned buffer, but this
is not common and I consider it bad coding practice.

> > +		if (r == XZ_STREAM_END) {
> 
> Again the same check?
Not really, r could have been changed since the above check (r = XZ_DATA_ERROR; when %4 check fails)

> >  		if (r == XZ_STREAM_END) {
> > -			break;
> > +			xz_dec_end(state);
> > +			/* Look for any other streams */
> > +			continue;
> 
> Why do you have three XZ_STREAM_END checks in this state machine?
I use XZ_STREAM_END to check end of stream and eat padding, to check
there is still valid data (no paddding error) before initializing
decoder, and finally to free the decoder at en of current stream.

Cheers,

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: