www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23261] New: druntime core.std.attribute.Tagged1_2 constructor

https://issues.dlang.org/show_bug.cgi?id=23261

          Issue ID: 23261
           Summary: druntime core.std.attribute.Tagged1_2 constructor is
                    unsafe
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

The code is:

version (UdaGNUAbiTag) struct gnuAbiTag
{
    string[] tags;

    this(string[] tags...)
    {
        this.tags = tags;
    }
}

Note that tags[] is constructed on the stack, so this is creating an expired
pointer on the stack, which can result in memory corruption. If the code is
marked with  safe, it will not compile.

--
Jul 20 2022