public inbox for ntfs3@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] ntfs3: fix out-of-bounds read in decompress_lznt
@ 2026-04-18 13:11 Tristan Madani
  2026-04-30 12:00 ` Konstantin Komarov
  0 siblings, 1 reply; 2+ messages in thread
From: Tristan Madani @ 2026-04-18 13:11 UTC (permalink / raw)
  To: almaz.alexandrovich; +Cc: ntfs3, linux-kernel, syzbot+39b2fb0f2638669008ec

From: Tristan Madani <tristan@talencesecurity.com>

decompress_lznt() does not validate array index bounds before accessing
the decompression table. A corrupted NTFS3 image with invalid compressed
data can trigger an out-of-bounds read.

Add index bounds checking to prevent the OOB access.

Reported-by: syzbot+39b2fb0f2638669008ec@syzkaller.appspotmail.com
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
 fs/ntfs3/lznt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ntfs3/lznt.c b/fs/ntfs3/lznt.c
index fdc9b2ebf3410..f818d97850049 100644
--- a/fs/ntfs3/lznt.c
+++ b/fs/ntfs3/lznt.c
@@ -240,7 +240,7 @@ static inline ssize_t decompress_chunk(u8 *unc, u8 *unc_end, const u8 *cmpr,
 		if (up - unc > LZNT_CHUNK_SIZE)
 			return -EINVAL;
 		/* Correct index */
-		while (unc + s_max_off[index] < up)
+		while (index < ARRAY_SIZE(s_max_off) - 1 && unc + s_max_off[index] < up)
 			index += 1;
 
 		/* Check the current flag for zero. */
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ntfs3: fix out-of-bounds read in decompress_lznt
  2026-04-18 13:11 [PATCH] ntfs3: fix out-of-bounds read in decompress_lznt Tristan Madani
@ 2026-04-30 12:00 ` Konstantin Komarov
  0 siblings, 0 replies; 2+ messages in thread
From: Konstantin Komarov @ 2026-04-30 12:00 UTC (permalink / raw)
  To: Tristan Madani; +Cc: ntfs3, linux-kernel, syzbot+39b2fb0f2638669008ec

On 4/18/26 15:11, Tristan Madani wrote:

> [You don't often get email from tristmd@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> From: Tristan Madani <tristan@talencesecurity.com>
>
> decompress_lznt() does not validate array index bounds before accessing
> the decompression table. A corrupted NTFS3 image with invalid compressed
> data can trigger an out-of-bounds read.
>
> Add index bounds checking to prevent the OOB access.
>
> Reported-by: syzbot+39b2fb0f2638669008ec@syzkaller.appspotmail.com
> Cc: stable@vger.kernel.org
> Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
> ---
>   fs/ntfs3/lznt.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ntfs3/lznt.c b/fs/ntfs3/lznt.c
> index fdc9b2ebf3410..f818d97850049 100644
> --- a/fs/ntfs3/lznt.c
> +++ b/fs/ntfs3/lznt.c
> @@ -240,7 +240,7 @@ static inline ssize_t decompress_chunk(u8 *unc, u8 *unc_end, const u8 *cmpr,
>                  if (up - unc > LZNT_CHUNK_SIZE)
>                          return -EINVAL;
>                  /* Correct index */
> -               while (unc + s_max_off[index] < up)
> +               while (index < ARRAY_SIZE(s_max_off) - 1 && unc + s_max_off[index] < up)
>                          index += 1;
>
>                  /* Check the current flag for zero. */
> --
> 2.47.3
>
Hello,

Sorry for the delay.
Your patch is applied, thank you.

Regards,
Konstantin


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-30 12:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-18 13:11 [PATCH] ntfs3: fix out-of-bounds read in decompress_lznt Tristan Madani
2026-04-30 12:00 ` Konstantin Komarov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox