D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20949 - std.range.popFront is unsafe in release mode
Summary: std.range.popFront is unsafe in release mode
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2020-06-18 13:03 UTC by ag0aep6g
Modified: 2020-06-19 01:13 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description ag0aep6g 2020-06-18 13:03:46 UTC
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 Dlang Bot 2020-06-18 13:30:19 UTC
@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 Dlang Bot 2020-06-19 01:13:53 UTC
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