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);