server: Fix the returned error code for an invalid NT header offset.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47359 Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
784b3f611a
commit
f59d05223d
|
@ -1153,6 +1153,11 @@ static void test_Loader(void)
|
||||||
}
|
}
|
||||||
((IMAGE_OS2_HEADER *)&nt_header)->ne_exetyp = ((IMAGE_OS2_HEADER *)&nt_header_template)->ne_exetyp;
|
((IMAGE_OS2_HEADER *)&nt_header)->ne_exetyp = ((IMAGE_OS2_HEADER *)&nt_header_template)->ne_exetyp;
|
||||||
|
|
||||||
|
dos_header.e_lfanew = 0x98760000;
|
||||||
|
status = map_image_section( &nt_header, §ion, section_data, __LINE__ );
|
||||||
|
ok( status == STATUS_INVALID_IMAGE_PROTECT, "NtCreateSection error %08x\n", status );
|
||||||
|
|
||||||
|
dos_header.e_lfanew = sizeof(dos_header);
|
||||||
nt_header.Signature = 0xdeadbeef;
|
nt_header.Signature = 0xdeadbeef;
|
||||||
status = map_image_section( &nt_header, §ion, section_data, __LINE__ );
|
status = map_image_section( &nt_header, §ion, section_data, __LINE__ );
|
||||||
ok( status == STATUS_INVALID_IMAGE_PROTECT, "NtCreateSection error %08x\n", status );
|
ok( status == STATUS_INVALID_IMAGE_PROTECT, "NtCreateSection error %08x\n", status );
|
||||||
|
|
|
@ -593,7 +593,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
|
||||||
pos = mz.dos.e_lfanew;
|
pos = mz.dos.e_lfanew;
|
||||||
|
|
||||||
size = pread( unix_fd, &nt, sizeof(nt), pos );
|
size = pread( unix_fd, &nt, sizeof(nt), pos );
|
||||||
if (size < sizeof(nt.Signature) + sizeof(nt.FileHeader)) return STATUS_INVALID_IMAGE_FORMAT;
|
if (size < sizeof(nt.Signature) + sizeof(nt.FileHeader)) return STATUS_INVALID_IMAGE_PROTECT;
|
||||||
/* zero out Optional header in the case it's not present or partial */
|
/* zero out Optional header in the case it's not present or partial */
|
||||||
size = min( size, sizeof(nt.Signature) + sizeof(nt.FileHeader) + nt.FileHeader.SizeOfOptionalHeader );
|
size = min( size, sizeof(nt.Signature) + sizeof(nt.FileHeader) + nt.FileHeader.SizeOfOptionalHeader );
|
||||||
if (size < sizeof(nt)) memset( (char *)&nt + size, 0, sizeof(nt) - size );
|
if (size < sizeof(nt)) memset( (char *)&nt + size, 0, sizeof(nt) - size );
|
||||||
|
|
Loading…
Reference in New Issue