fs/ntfs3/lznt.c | 3 +++ 1 file changed, 3 insertions(+)
#syz test
a incorrectly formatted chunk may decompress into
more than LZNT_CHUNK_SIZE bytes and a index out of bounds
will occur in s_max_off.
Signed-off-by: Andrew Ballance <andrewjballance@gmail.com>
---
fs/ntfs3/lznt.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/ntfs3/lznt.c b/fs/ntfs3/lznt.c
index 4aae598d6d88..fdc9b2ebf341 100644
--- a/fs/ntfs3/lznt.c
+++ b/fs/ntfs3/lznt.c
@@ -236,6 +236,9 @@ static inline ssize_t decompress_chunk(u8 *unc, u8 *unc_end, const u8 *cmpr,
/* Do decompression until pointers are inside range. */
while (up < unc_end && cmpr < cmpr_end) {
+ // return err if more than LZNT_CHUNK_SIZE bytes are written
+ if (up - unc > LZNT_CHUNK_SIZE)
+ return -EINVAL;
/* Correct index */
while (unc + s_max_off[index] < up)
index += 1;
--
2.45.0
Hello, syzbot has tested the proposed patch and the reproducer did not trigger any issue: Reported-and-tested-by: syzbot+39b2fb0f2638669008ec@syzkaller.appspotmail.com Tested on: commit: 1b294a1f Merge tag 'net-next-6.10' of git://git.kernel.. git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=15998648980000 kernel config: https://syzkaller.appspot.com/x/.config?x=c0cd0c5dbf8ea592 dashboard link: https://syzkaller.appspot.com/bug?extid=39b2fb0f2638669008ec compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40 patch: https://syzkaller.appspot.com/x/patch.diff?x=115b78f0980000 Note: testing is done by a robot and is best-effort only.
© 2016 - 2026 Red Hat, Inc.