Hi everyone,

I was playing around with the busybox master branch and found an
issue with the "libarchive: treat one "FIXME: avoid seek"" patch
(commit hash dff2bd733fc2dac08d34f2cfad0e68aeb8e7a7a2).

The xmalloc_read_with_inital_buf() accepts xstate->signature_skipped as the
buffer offset/initial buffer size. In case of uncompressed files
(no known 2-byte signature was found at the start), the signature_skipped is 0
(see open_transformer.c:355).
However, the src_fd file position is already shifted, and the first two bytes
have been already read into the xstate by open_transformer() function.
Passing 0 as offset/buffer size leads to the first two bytes being lost.

I have run into this issue while loading the uncompressed kernel
module with insmod. Removing the xstate->signature_skipped = 0;
line fixes the issue for me.

This is my first message on the mailing list, so please accept my apologies
if this message is not properly formatted. I can provide a patch with the fix,
but it may need some time to get familiar with the contributing guide.

Best regards,
Rostyslav
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to