www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5492] New: immutable string can be changed by stdin.readln

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5492

           Summary: immutable string can be changed by stdin.readln
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: mrmocool gmx.de



import std.stdio;

void main()
{
    immutable char[] buf = "hello";
    writefln("buf = %s",buf);
    stdin.readln(buf);
    writefln("buf = %s",buf);
}

compiles and runs without errors.
Steven said it segfaults on Linux.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 26 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5492


Steven Schveighoffer <schveiguy yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |schveiguy yahoo.com
         Resolution|                            |DUPLICATE



13:10:20 PST ---
Marking this as the duplicate, since the original poster made the later bug
(both reports are pretty much identical)

*** This issue has been marked as a duplicate of issue 5493 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 26 2011