From: Phillip Lougher <phillip@squashfs.org.uk>
To: Ran Hongyun <ranhongyun1@huawei.com>
Cc: linux-kernel@vger.kernel.org, chengzhihao1@huawei.com,
yangerkun@huawei.com, yi.zhang@huawei.com, brauner@kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2] squashfs: Add dictionary size range check to prevent shift-out-of-bounds
Date: Wed, 22 Jul 2026 07:21:16 +0100 [thread overview]
Message-ID: <8875193b-e30e-4dc3-8222-714300768cd0@squashfs.org.uk> (raw)
In-Reply-To: <20260713115525.2661734-1-ranhongyun1@huawei.com>
On 13/07/2026 12:55, Ran Hongyun wrote:
> When an abnormal SquashFS image (COMP_OPTS flag is 1 but dictionary size
> is 0) is mounted, and performs shift operations using dictionarysize, the
> shift exponent is -1, causing a shift-out-of-bounds.
>
> Detail as below:
> squashfs_comp_opts(msblk, buffer, length)
> squashfs_xz_comp_opts()
> if (comp_opts)
> n = ffs(opts->dict_size) - 1;<----opts->dict_size=0, n=-1
> if (opts->dict_size != (1 << n) && opts->dict_size !=
> (1 << n) + (1 << (n + 1))) <----shift-out-of-bounds
>
> Fix it by adding a dictionary size range check before the shift operation.
Reviewed-by: Phillip Lougher <phillip@squashfs.org.uk>
Andrew Morton handles patch submission to Linus for me. CC'ing him.
Phillip
next prev parent reply other threads:[~2026-07-22 6:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 11:55 Ran Hongyun
2026-07-16 13:32 ` Zhihao Cheng
2026-07-22 6:21 ` Phillip Lougher [this message]
2026-09-16 7:43 ` [PATCH 0/2] lockd: fix two bugs on nlmclnt_find_lockowner() failure path Ran Hongyun
2026-09-16 8:27 ` [PATCH v2] squashfs: Add dictionary size range check to prevent shift-out-of-bounds Christian Brauner
2026-09-16 8:38 ` Ran Hongyun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8875193b-e30e-4dc3-8222-714300768cd0@squashfs.org.uk \
--to=phillip@squashfs.org.uk \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=chengzhihao1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ranhongyun1@huawei.com \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®