[Issue 663] New: Slice assignment does not bounds check when it should

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 7 07:17:48 PST 2006


http://d.puremagic.com/issues/show_bug.cgi?id=663

           Summary: Slice assignment does not bounds check when it should
           Product: D
           Version: 0.175
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: burton-radons at smocky.com


This code compiles and executes:

        auto test = new char [2];

        test [] = 'a';
        test = test [0 .. 1];
        test [0 .. 2] = 'b'; // this line should assert
        writef ("%s\n", test.ptr [0 .. 2]);

And produces the string "bb"; at the very least it should be "ba". DMD should
throw an assertion failure at runtime on the marked line when -release mode is
not specified.


-- 




More information about the Digitalmars-d-bugs mailing list