www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24275] New: pragma(mangle, ...) can hijack safe functions,

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 puremagic.com
          Reporter: timon.gehr 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".

--
Dec 08 2023