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: nob...@puremagic.com
          Reporter: timon.g...@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".

--

Reply via email to