Commit f114ba11 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Use the right section size when setting protections.

Use the same size computation when setting section protections than when mapping it in the first place (reported by Nicholas Miell).
parent fd61c3f2
......@@ -1150,8 +1150,14 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
sec = (IMAGE_SECTION_HEADER*)((char *)&nt->OptionalHeader+nt->FileHeader.SizeOfOptionalHeader);
for (i = 0; i < nt->FileHeader.NumberOfSections; i++, sec++)
{
SIZE_T size = ROUND_SIZE( sec->VirtualAddress, sec->Misc.VirtualSize );
SIZE_T size;
BYTE vprot = VPROT_COMMITTED;
if (sec->Misc.VirtualSize)
size = ROUND_SIZE( sec->VirtualAddress, sec->Misc.VirtualSize );
else
size = ROUND_SIZE( sec->VirtualAddress, sec->SizeOfRawData );
if (sec->Characteristics & IMAGE_SCN_MEM_READ) vprot |= VPROT_READ;
if (sec->Characteristics & IMAGE_SCN_MEM_WRITE) vprot |= VPROT_READ|VPROT_WRITECOPY;
if (sec->Characteristics & IMAGE_SCN_MEM_EXECUTE) vprot |= VPROT_EXEC;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment