[Issue 24275] New: pragma(mangle, ...) can hijack safe functions, bypassing @safe checks
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Dec 8 16:28:28 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24275
Issue ID: 24275
Summary: pragma(mangle, ...) can hijack safe functions,
bypassing @safe checks
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Keywords: safe
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: timon.gehr at gmx.ch
DMD 2.106.0:
```d
@safe:
import std.stdio;
pragma(mangle,bar.mangleof)
void foo()@system{
writeln("corrupted memory");
}
void bar()@safe{
writeln("beningn code");
}
void main()@safe{
bar();
}
```
Prints: "corrupted memory".
--
More information about the Digitalmars-d-bugs
mailing list