https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9293b975ef6695b031b8c…
commit 9293b975ef6695b031b8ccce36b9c5508218772d
Author: Roy Tam <roytam(a)gmail.com>
AuthorDate: Fri Jan 20 17:02:37 2023 +0800
Commit: Roy Tam <roytam(a)gmail.com>
CommitDate: Fri Jan 20 17:02:37 2023 +0800
[NTDLL_APITEST] Add test for a section where PointerToRawData = 0 while SizeOfRawData
!= 0. CORE-18797
---
.../rostests/apitests/ntdll/NtMapViewOfSection.c | 24 ++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/modules/rostests/apitests/ntdll/NtMapViewOfSection.c
b/modules/rostests/apitests/ntdll/NtMapViewOfSection.c
index 8723696c924..4a6e187a08b 100644
--- a/modules/rostests/apitests/ntdll/NtMapViewOfSection.c
+++ b/modules/rostests/apitests/ntdll/NtMapViewOfSection.c
@@ -1498,7 +1498,8 @@ static struct _RAW_SIZE_IMAGE_FILE
IMAGE_SECTION_HEADER data_header;
IMAGE_SECTION_HEADER zdata_header;
IMAGE_SECTION_HEADER rsrc_header;
- BYTE pad[488];
+ IMAGE_SECTION_HEADER bss_header;
+ BYTE pad[448];
BYTE text_data[0x1200];
BYTE data_data[0x1200];
BYTE rsrc_data[0x400];
@@ -1522,7 +1523,7 @@ static struct _RAW_SIZE_IMAGE_FILE
/* IMAGE_FILE_HEADER */
{
IMAGE_FILE_MACHINE_I386, /* Machine */
- 4, /* NumberOfSections */
+ 5, /* NumberOfSections */
0x47EFDF09, /* TimeDateStamp */
0, /* PointerToSymbolTable */
0, /* NumberOfSymbols */
@@ -1646,6 +1647,21 @@ static struct _RAW_SIZE_IMAGE_FILE
IMAGE_SCN_MEM_READ |
IMAGE_SCN_CNT_INITIALIZED_DATA, /* Characteristics */
},
+ /* IMAGE_SECTION_HEADER */
+ {
+ /* PointerToRawData = 0 while SizeOfRawData != 0, CORE-18797 */
+ ".bss", /* Name */
+ { 0x400 }, /* Misc.VirtualSize */
+ 0x5000, /* VirtualAddress */
+ 0x600, /* SizeOfRawData */
+ 0, /* PointerToRawData */
+ 0, /* PointerToRelocations */
+ 0, /* PointerToLinenumbers */
+ 0, /* NumberOfRelocations */
+ 0, /* NumberOfLinenumbers */
+ IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_READ |
+ IMAGE_SCN_CNT_UNINITIALIZED_DATA, /* Characteristics */
+ },
/* fill */
{ 0 },
/* text */
@@ -1802,6 +1818,10 @@ Test_RawSize(ULONG TestNumber)
ok_hex(ImageFile->zdata_header.SizeOfRawData,
RawSizeImageFile.zdata_header.SizeOfRawData);
ok_hex(ImageFile->zdata_header.PointerToRawData, 0);
+ /* PointerToRawData = 0 resets SizeOfRawData to 0, CORE-18797 */
+ ok_hex(ImageFile->bss_header.SizeOfRawData, 0);
+ ok_hex(ImageFile->bss_header.PointerToRawData, 0);
+
#define TEST_BYTE(n, v) \
StartSeh() \
ok(Bytes[n] == v, "[%lu] Bytes[%u] = 0x%x, expected 0x%x\n", \