Thread overview
[Issue 1716] New: Access Violation at readln
Dec 07, 2007
d-bugmail
Dec 07, 2007
d-bugmail
Dec 07, 2007
d-bugmail
Mar 08, 2008
d-bugmail
Mar 08, 2008
d-bugmail
Mar 08, 2008
d-bugmail
Mar 09, 2008
d-bugmail
May 06, 2009
d-bugmail
December 07, 2007
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


+++ This issue was initially created as a clone of Issue #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


-- 

December 07, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1716





------- Comment #1 from Hans-Werner.Krause@lycos.de  2007-12-07 09:05 -------
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


-- 

December 07, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1716





------- Comment #2 from Hans-Werner.Krause@lycos.de  2007-12-07 09:06 -------
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


-- 

March 08, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1716





------- Comment #3 from bugzilla@digitalmars.com  2008-03-08 01:30 -------
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.


-- 

March 08, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1716





------- Comment #5 from braddr@puremagic.com  2008-03-08 14:48 -------
It's unclear from your response.  Is the bug fixed or not?  If not, what's the current problem?


-- 

March 08, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1716





------- Comment #6 from braddr@puremagic.com  2008-03-08 15:01 -------
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.


-- 

March 09, 2008
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




------- Comment #8 from matti.niemenmaa+dbugzilla@iki.fi  2008-03-09 03:46 -------
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");


-- 

May 06, 2009
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



------- Comment #12 from gide@nwawudu.com  2009-05-06 04:54 -------
*** Bug 1706 has been marked as a duplicate of this bug. ***


--