Bug 23261 – druntime core.std.attribute.Tagged1_2 constructor is unsafe
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-07-21T01:56:51Z
Last change time
2023-01-06T07:43:32Z
Keywords
pull
Assigned to
No Owner
Creator
Walter Bright
Comments
Comment #0 by bugzilla — 2022-07-21T01:56:51Z
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.
Comment #1 by dlang-bot — 2023-01-02T12:34:20Z
@RazvanN7 created dlang/dmd pull request #14771 "Fix Issue 23261 - druntime core.std.attribute.Tagged1_2 constructor i…" fixing this issue:
- Fix Issue 23261 - druntime core.std.attribute.Tagged1_2 constructor is unsafe
https://github.com/dlang/dmd/pull/14771
Comment #2 by pro.mathias.lang — 2023-01-05T10:35:32Z
Yes but the code is only intended to be used as an UDA, so it shouldn't matter.
Comment #3 by dlang-bot — 2023-01-06T07:43:32Z
dlang/dmd pull request #14771 "Fix Issue 23261 - druntime core.std.attribute.Tagged1_2 constructor i…" was merged into master:
- bac6a64dfc90820809dff2c5609f03d1bdb532e9 by RazvanN7:
Fix Issue 23261 - druntime core.std.attribute.Tagged1_2 constructor is unsafe
https://github.com/dlang/dmd/pull/14771