Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 64F2A109C047 for ; Thu, 26 Mar 2026 10:33:05 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4fhKqM6fL8z2yS4; Thu, 26 Mar 2026 21:33:03 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=pass smtp.remote-ip=103.117.158.51 arc.chain=zohomail.in ARC-Seal: i=2; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1774521183; cv=pass; b=lX8C/9ZVA7/8F4ImzQR7EkoK+s8sejYk/FcCDy8xxAbdzvil6kFON723Xe0ljx6k/HSBV7RjF7EUwk6p3ELqjp3iIFe5fS6wJgs1y1D67+b21cYQfoCsUKiY0wgICfu1xi5OAm3a9SzF6EOXTP9E6Sxn8HRlaxjvkcCTdkNxwDNFe0xCKoMa2UKHNZLG63baI77Ts8JiKCtuPH+1a3UzeaJatM2KNv4fMwKq5PwbXx1PT/P2xPZ93WB2uIWTtTBQgouXVo8tFK9BActPy9HpI3tR0ofBt2543NW0wTD5kfZcUSUZdJUXxVQwNQUeN3nunDkTh2/tT9Bcz6GCblaKCw== ARC-Message-Signature: i=2; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1774521183; c=relaxed/relaxed; bh=tIxTga/wk3b2Njr0Rt9t20LBuhoOiFUzKzvVh4DP4iQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=GVRGnFXbmmbKxcRX0pqtelzMVLLcL76a8tlf7XRgdfJ29YgeIRFsIkVJsAijGt+JYZhYJlfMYTjHOOAvbaQyP0vtCUEUB6IEuOQznkYR/nF8Vntz0XYZDZR0cpb4pwTXygvlhXsmECpBTpG5WCe36uESlIrd1DLiJL8ZIikteOC4+xubCmtMgNwilKMFY68QoK+RantT2mikn/n0s5lFAb3DtylEntrR9sh1qleYPex7MyEWNzbgHAsg4Je2/oyCJCX8rBa6JNE1ucmNiLZrcHh6qg7UjfmYONzL2C1s9PMPg03QE8b9yeLhHsuTvcdy+euTgDhTb4Uv7XPuNMNkRg== ARC-Authentication-Results: i=2; lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=vnsh.in; dkim=pass (1024-bit key; unprotected) header.d=vnsh.in header.i=ch@vnsh.in header.a=rsa-sha256 header.s=zoho header.b=DGLRnNhf; dkim-atps=neutral; spf=pass (client-ip=103.117.158.51; helo=sender-of-o51.zoho.in; envelope-from=ch@vnsh.in; receiver=lists.ozlabs.org) smtp.mailfrom=vnsh.in Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=vnsh.in Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=vnsh.in header.i=ch@vnsh.in header.a=rsa-sha256 header.s=zoho header.b=DGLRnNhf; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vnsh.in (client-ip=103.117.158.51; helo=sender-of-o51.zoho.in; envelope-from=ch@vnsh.in; receiver=lists.ozlabs.org) Received: from sender-of-o51.zoho.in (sender-of-o51.zoho.in [103.117.158.51]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4fhKqL4KcVz2xlM for ; Thu, 26 Mar 2026 21:33:02 +1100 (AEDT) ARC-Seal: i=1; a=rsa-sha256; t=1774521175; cv=none; d=zohomail.in; s=zohoarc; b=NUbFoAw5D74wzGMXX5Degct1ICWNJQfjGhTZYfJAzeLbZaJOSa/D8499GqqI/7UVcxLa2YC2sSYUn/uNAretCOWiwTGKbhP9xT0TemddUnqd5/1NWf26eaO3Wb+TGZvsbMAnc0w4pDNS6UzgHPoEZVuGtrYe2/rnEkoA/36yliU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.in; s=zohoarc; t=1774521175; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=tIxTga/wk3b2Njr0Rt9t20LBuhoOiFUzKzvVh4DP4iQ=; b=a38eNlsHho8PQ29FczDARvPSOqMDx3OjQDtF/X+nxYLC/ToDFquCGZ2+RhibiDYXOaYRkvCXhIkai47gfiK0iH3BibNRJBDah7iHQsYgpNh7U0Z6U7vM3K3kzA5gV+bOApSPOawo3bn/8SwvPXt6Yw4R/s6BaaUkFcOct4TZ9J8= ARC-Authentication-Results: i=1; mx.zohomail.in; dkim=pass header.i=vnsh.in; spf=pass smtp.mailfrom=ch@vnsh.in; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1774521175; s=zoho; d=vnsh.in; i=ch@vnsh.in; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=tIxTga/wk3b2Njr0Rt9t20LBuhoOiFUzKzvVh4DP4iQ=; b=DGLRnNhfZr5i1jqSLTxnrsDphLxdb4E94yKA20dmCkMALUAprA0fEDxgrPZQgQ93 BEwYrf0MNS/hQxdCkV+X/T0fkfBczEWJamKURDMBupvcL37W4tq6XlI+I6tYm7dDE20 +l4fm3DS0ijHBl2hIfy/0AdedK8IW3v2fs+qtQGg= Received: by mx.zoho.in with SMTPS id 1774521174773628.6457214836197; Thu, 26 Mar 2026 16:02:54 +0530 (IST) From: Vansh Choudhary To: linux-erofs@lists.ozlabs.org Cc: Vansh Choudhary Subject: [PATCH] erofs-utils: tar: fix multi-chunk metadata reads Date: Thu, 26 Mar 2026 10:32:54 +0000 Message-ID: <20260326103254.32152-1-ch@vnsh.in> X-Mailer: git-send-email 2.43.0 X-Mailing-List: linux-erofs@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-ZohoMailClient: External Advance the destination buffer in erofs_iostream_bread() after each erofs_iostream_read() call. Without that, metadata reads that span multiple stream chunks keep overwriting the start of the output buffer, which can corrupt PAX headers, GNU long names, long links, and other buffered metadata. Signed-off-by: Vansh Choudhary --- lib/tar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tar.c b/lib/tar.c index 70bf091..77754fd 100644 --- a/lib/tar.c +++ b/lib/tar.c @@ -250,6 +250,7 @@ int erofs_iostream_read(struct erofs_iostream *ios, void **buf, u64 bytes) int erofs_iostream_bread(struct erofs_iostream *ios, void *buf, u64 bytes) { u64 rem = bytes; + u8 *dst = buf; void *src; int ret; @@ -257,7 +258,8 @@ int erofs_iostream_bread(struct erofs_iostream *ios, void *buf, u64 bytes) ret = erofs_iostream_read(ios, &src, rem); if (ret < 0) return ret; - memcpy(buf, src, ret); + memcpy(dst, src, ret); + dst += ret; rem -= ret; } while (rem && ret); -- 2.43.0