From d436f2e76b13d3dc24df8953135c620adbd0cb70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Thu, 9 Oct 2025 21:51:54 +0200 Subject: [PATCH] [EXT2FS] Fix an uninitialized variable usage RTC failure Cherry-picking commit https://github.com/bobranten/Ext4Fsd/commit/3158b917a20019d2fdc3fb84b9ac4ac03af7b862 See https://github.com/bobranten/Ext4Fsd/issues/83 for more information, and debug traces. ## How to reproduce: - Format a partition in Ext2 with Paragon Hard Disk Manager 2010 Professional. - Compile ReactOS with MSVC, ensuring that the driver is compiled with `EXT2_HTREE_INDEX` defined and set to 1, and with Run-time error checks enabled with the `/RTC1` flag (this is the default in our source tree). - Install ReactOS on this partition. ## What's being observed: After reboot, some filesystem paths are accessed, and the code inside the `#ifdef EXT2_HTREE_INDEX` block is taken (in ext2/src/dirctl.c#L777-L794). For some reasons, the retrieved `rc` doesn't get the "expected" value and the `goto errorout;` path is taken. After this label, `FileIndex` was reset to `ByteOffset`, which remained uninitialized. A bugcheck ensues because of the failed check (usage of uninitialized variable). --- drivers/filesystems/ext2/src/dirctl.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/filesystems/ext2/src/dirctl.c b/drivers/filesystems/ext2/src/dirctl.c index 668b9c23f66..dfeda7b91bb 100644 --- a/drivers/filesystems/ext2/src/dirctl.c +++ b/drivers/filesystems/ext2/src/dirctl.c @@ -968,7 +968,6 @@ ProcessNextEntry: errorout: ((PULONG)((PUCHAR)Buffer + fc.efc_prev))[0] = 0; - FileIndex = ByteOffset; if (Status == STATUS_BUFFER_OVERFLOW) { /* just return fc.efc_start/EntrySize bytes that we filled */