Bug 24631 – Pointer cast allows changing @system field in @safe code
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2024-06-26T12:33:19Z
Last change time
2024-06-26T13:29:56Z
Keywords
pull, safe
Assigned to
No Owner
Creator
Nick Treleaven
Comments
Comment #0 by nick — 2024-06-26T12:33:19Z
struct S
{
@system int i;
}
void main() @safe
{
S s;
auto p = cast(int*) &s;
*p = 8;
int i = 8;
auto ps = cast(S*) &i;
}
PR incoming.
Comment #1 by dlang-bot — 2024-06-26T12:35:22Z
@ntrel created dlang/dmd pull request #16625 "Fix Bugzilla 24631 - Pointer cast allows changing @system field in @s…" fixing this issue:
- Fix Bugzilla 24631 - Pointer cast allows changing @system field in @safe code
https://github.com/dlang/dmd/pull/16625
Comment #2 by dlang-bot — 2024-06-26T13:29:56Z
dlang/dmd pull request #16625 "Fix Bugzilla 24631 - Pointer cast allows changing @system field in @s…" was merged into master:
- e165693f621ea8a0f6f6f5cc3ec3f65ab49f3708 by Nick Treleaven:
Fix Bugzilla 24631 - Pointer cast allows changing @system field in @safe code
https://github.com/dlang/dmd/pull/16625