Bug 20949 – std.range.popFront is unsafe in release mode
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-06-18T13:03:46Z
Last change time
2020-06-19T01:13:53Z
Keywords
pull
Assigned to
No Owner
Creator
ag0aep6g
Comments
Comment #0 by ag0aep6g — 2020-06-18T13:03:46Z
Compile with `-release`:
----
import std.range.primitives: popFront;
import std.stdio: writeln;
void main() @safe
{
char[3] a = "foo";
int x = 42;
char[] b = a[0 .. 0];
b.popFront();
b[3] = 13; /* Writes over x. */
writeln(x); /* Prints "13". */
}
----
Comment #1 by dlang-bot — 2020-06-18T13:30:19Z
@aG0aep6G created dlang/phobos pull request #7535 "fix issue 20949 - std.range.popFront is unsafe in release mode" fixing this issue:
- fix issue 20949 - std.range.popFront is unsafe in release mode
https://github.com/dlang/phobos/pull/7535
Comment #2 by dlang-bot — 2020-06-19T01:13:53Z
dlang/phobos pull request #7535 "fix issue 20949 - std.range.popFront is unsafe in release mode" was merged into master:
- 26822f44b5947137b19ba7094095f061334376a2 by aG0aep6G:
fix issue 20949 - std.range.popFront is unsafe in release mode
https://github.com/dlang/phobos/pull/7535