www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1716] New: Access Violation at readln

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

           Summary: Access Violation at readln
           Product: D
           Version: 1.015
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: EH
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: Hans-Werner.Krause lycos.de
 BugsThisDependsOn: 1706




I got an access-violation in line 22. When i change line 131 to 'char[] pattern
= "pj-?0000";', that means not loading "pj-5000", the program runs without an
error. That looks like a bug because in another version of the program i can
load "pj-10000" after "pj-5000" with no problems.
The URL for the program is 'http://paste.pocoo.org/show/13445/', for "pj-5000"
'http://paste.pocoo.org/show/13446/' and for "pj-10000"
'http://paste.pocoo.org/show/13447/'.
Thanks in advance
HW


-- 
Dec 07 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1716






Created an attachment (id=215)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=215&action=view)
Zip with source, binary and data-files

Zip with source, binary and data-files


-- 
Dec 07 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1716






Created an attachment (id=216)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=216&action=view)
Zip with source, binary and data-files

Zip with source, binary and data-files


-- 
Dec 07 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1716






Can you please try to reduce it to a smaller example? 99K compressed is awfully
large, and requires a lot of time investment for someone else to figure out
what is happening with it.


-- 
Mar 07 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1716






It's unclear from your response.  Is the bug fixed or not?  If not, what's the
current problem?


-- 
Mar 08 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1716






I tried to reproduce the problem on linux with 1.015 and couldn't.  I tried
both with and without -O, both with and without -release.  I tried reading the
2000 before the 10000, and vice versa.

It's possible that this is a windows specific failure, but...

Please provide exact reproduction steps to demonstrate the problem.


-- 
Mar 08 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1716


matti.niemenmaa+dbugzilla iki.fi changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
           Keywords|EH                          |
         Resolution|                            |INVALID





-------
The problem is line 21:

    FILE* file = fopen(cast(char*)filename, "r");

You can't just cast a char[] to a char* like that. C functions like fopen
expect a terminating null character in every string, and your char[] doesn't
have one.

The correct way to do this is to convert it to a null-terminated string:

    FILE* file = fopen(toStringz(filename), "r");


-- 
Mar 09 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1716


Bug 1716 depends on bug 1706, which changed state.

Bug 1706 Summary: Access Violation at readln
http://d.puremagic.com/issues/show_bug.cgi?id=1706

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE




*** Bug 1706 has been marked as a duplicate of this bug. ***


-- 
May 06 2009