Bug 24079 – core.sys.windows.winnt.IMAGE_FIRST_SECTION returns bad pointer

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2023-08-08T15:48:26Z
Last change time
2023-08-15T22:23:19Z
Keywords
pull
Assigned to
No Owner
Creator
Nathan S.

Comments

Comment #0 by n8sh.secondary — 2023-08-08T15:48:26Z
IMAGE_FIRST_SECTION adds an integer representing a number of bytes to a pointer of type IMAGE_OPTIONAL_HEADER* resulting in a change 240 times (IMAGE_OPTIONAL_HEADER64*) or 224 times (IMAGE_OPTIONAL_HEADER32*) as large as intended. https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-image_file_header "SizeOfOptionalHeader: The size of the optional header, in bytes." core.sys.windows.winnt.d: --- PIMAGE_SECTION_HEADER IMAGE_FIRST_SECTION(PIMAGE_NT_HEADERS h) { return cast(PIMAGE_SECTION_HEADER) (&h.OptionalHeader + h.FileHeader.SizeOfOptionalHeader); } ---
Comment #1 by dlang-bot — 2023-08-08T15:54:04Z
@n8sh created dlang/dmd pull request #15519 "Fix Issue 24079 - core.sys.windows.winnt.IMAGE_FIRST_SECTION returns bad pointer" fixing this issue: - Fix Issue 24079 - core.sys.windows.winnt.IMAGE_FIRST_SECTION returns bad pointer https://github.com/dlang/dmd/pull/15519
Comment #2 by dlang-bot — 2023-08-08T19:55:49Z
dlang/dmd pull request #15519 "Fix Issue 24079 - core.sys.windows.winnt.IMAGE_FIRST_SECTION returns bad pointer" was merged into stable: - 67a99c0ab01b4b1b8cb9f6542497050ad4eaeaea by Nathan Sashihara: Fix Issue 24079 - core.sys.windows.winnt.IMAGE_FIRST_SECTION returns bad pointer https://github.com/dlang/dmd/pull/15519
Comment #3 by dlang-bot — 2023-08-15T22:23:19Z
dlang/dmd pull request #15540 "merge stable" was merged into master: - c32f0a3799cd7a736d3ff2b80bc2f9377b7ee96f by Nathan Sashihara: Fix Issue 24079 - core.sys.windows.winnt.IMAGE_FIRST_SECTION returns bad pointer (#15519) https://github.com/dlang/dmd/pull/15540