Author: tfaber
Date: Sun Feb 26 11:31:51 2017
New Revision: 73921
URL: http://svn.reactos.org/svn/reactos?rev=73921&view=rev
Log:
[KMTESTS:IO]
- Avoid a crash in IoFilesystem on Windows when using a free kernel with ntfs. Querying FileAllInformation with any size below sizeof(FILE_ALL_INFORMATION) is considered illegal, so only do it on checked builds (which have a size check).
Modified:
trunk/rostests/kmtests/ntos_io/IoFilesystem.c
Modified: trunk/rostests/kmtests/ntos_io/IoFilesystem.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_io/IoFilesys…
==============================================================================
--- trunk/rostests/kmtests/ntos_io/IoFilesystem.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/ntos_io/IoFilesystem.c [iso-8859-1] Sun Feb 26 11:31:51 2017
@@ -115,13 +115,24 @@
ok_eq_size(Length, (ULONG_PTR)0x5555555555555555);
if (FileAllInfo)
KmtFreeGuarded(FileAllInfo);
+
+ /* No space for the name -- fastfat handles this gracefully, ntfs doesn't.
+ * But the Io manager makes it fail on checked builds, so it's
+ * technically illegal
+ */
+ Length = FIELD_OFFSET(FILE_ALL_INFORMATION, NameInformation.FileName);
+ Status = QueryFileInfo(FileHandle, (PVOID*)&FileAllInfo, &Length, FileAllInformation);
+ ok_eq_hex(Status, STATUS_INFO_LENGTH_MISMATCH);
+ ok_eq_size(Length, (ULONG_PTR)0x5555555555555555);
+ if (FileAllInfo)
+ KmtFreeGuarded(FileAllInfo);
}
/* The minimum allowed */
- Length = FIELD_OFFSET(FILE_ALL_INFORMATION, NameInformation.FileName);
+ Length = sizeof(FILE_ALL_INFORMATION);
Status = QueryFileInfo(FileHandle, (PVOID*)&FileAllInfo, &Length, FileAllInformation);
ok_eq_hex(Status, STATUS_BUFFER_OVERFLOW);
- ok_eq_size(Length, FIELD_OFFSET(FILE_ALL_INFORMATION, NameInformation.FileName));
+ ok_eq_size(Length, sizeof(FILE_ALL_INFORMATION));
if (FileAllInfo)
KmtFreeGuarded(FileAllInfo);
Author: pschweitzer
Date: Sun Feb 26 11:27:24 2017
New Revision: 73920
URL: http://svn.reactos.org/svn/reactos?rev=73920&view=rev
Log:
[NTOSKRNL]
Spotted with kmtest:IoFilesystem: these checks are not performed in free builds for kernel callers and are delegated to the FSD.
Modified:
trunk/reactos/ntoskrnl/io/iomgr/iofunc.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/iofunc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iofunc.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iofunc.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iofunc.c [iso-8859-1] Sun Feb 26 11:27:24 2017
@@ -2115,6 +2115,7 @@
}
_SEH2_END;
}
+#if DBG
else
{
/* Validate the information class */
@@ -2132,6 +2133,7 @@
return STATUS_INFO_LENGTH_MISMATCH;
}
}
+#endif
/* Reference the Handle */
Status = ObReferenceObjectByHandle(FileHandle,