* [PATCH] ntfs3: check if more than chunk-size bytes are written [not found] <00000000000077d29606186c5e99@google.com> @ 2024-05-15 12:38 ` Andrew Ballance 2024-05-15 12:59 ` [syzbot] [ntfs3?] UBSAN: array-index-out-of-bounds in decompress_lznt syzbot 0 siblings, 1 reply; 2+ messages in thread From: Andrew Ballance @ 2024-05-15 12:38 UTC (permalink / raw) To: syzbot+39b2fb0f2638669008ec Cc: almaz.alexandrovich, linux-kernel, ntfs3, syzkaller-bugs, skhan, linux-kernel-mentees, Andrew Ballance #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 ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [syzbot] [ntfs3?] UBSAN: array-index-out-of-bounds in decompress_lznt 2024-05-15 12:38 ` [PATCH] ntfs3: check if more than chunk-size bytes are written Andrew Ballance @ 2024-05-15 12:59 ` syzbot 0 siblings, 0 replies; 2+ messages in thread From: syzbot @ 2024-05-15 12:59 UTC (permalink / raw) To: almaz.alexandrovich, andrewjballance, linux-kernel-mentees, linux-kernel, ntfs3, skhan, syzkaller-bugs 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. ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-15 12:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <00000000000077d29606186c5e99@google.com>
2024-05-15 12:38 ` [PATCH] ntfs3: check if more than chunk-size bytes are written Andrew Ballance
2024-05-15 12:59 ` [syzbot] [ntfs3?] UBSAN: array-index-out-of-bounds in decompress_lznt syzbot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox