Bug 1716 – Access Violation at readln

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-12-07T09:03:00Z
Last change time
2014-02-16T15:26:24Z
Assigned to
bugzilla
Creator
Hans-Werner.Krause
Depends on
1706

Attachments

IDFilenameSummaryContent-TypeSize
215Bonus.zipZip with source, binary and data-filesapplication/x-zip-compressed101397
216Bonus.zipZip with source, binary and data-filesapplication/x-zip-compressed101397

Comments

Comment #0 by Hans-Werner.Krause — 2007-12-07T09:03:04Z
+++ 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
Comment #1 by Hans-Werner.Krause — 2007-12-07T09:05:59Z
Created attachment 215 Zip with source, binary and data-files Zip with source, binary and data-files
Comment #2 by Hans-Werner.Krause — 2007-12-07T09:06:06Z
Created attachment 216 Zip with source, binary and data-files Zip with source, binary and data-files
Comment #3 by bugzilla — 2008-03-08T01:30:05Z
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.
Comment #4 by Hans-Werner.Krause — 2008-03-08T12:34:19Z
I think it's not necessary. The pure Code is only 3685 Bytes uncompressed. The biggest part of the Zip is the compiled Exe with 138 KBytes. The rest are 2 data-files. For information: In the new D-version this error doesn't occur, but i have to change the code for correct running. ----- Original Message ----- From: <[email protected]> To: <[email protected]> Sent: Saturday, March 08, 2008 8:30 AM Subject: [Issue 1716] Access Violation at readln > http://d.puremagic.com/issues/show_bug.cgi?id=1716 > > > > > > ------- Comment #3 from [email protected] 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. > > > -- > Configure bugmail: http://d.puremagic.com/issues/userprefs.cgi?tab=email > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter. >
Comment #5 by braddr — 2008-03-08T14:48:19Z
It's unclear from your response. Is the bug fixed or not? If not, what's the current problem?
Comment #6 by braddr — 2008-03-08T15:01:56Z
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.
Comment #7 by Hans-Werner.Krause — 2008-03-08T18:20:57Z
Just start Bonus.exe. The output in Windows XP SP2 is: pj-2000: 972 Error: Access Violation The Exe was built with DMD 1.015 ----- Original Message ----- From: <[email protected]> To: <[email protected]> Sent: Saturday, March 08, 2008 10:01 PM Subject: [Issue 1716] Access Violation at readln > http://d.puremagic.com/issues/show_bug.cgi?id=1716 > > > > > > ------- Comment #6 from [email protected] 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. > > > -- > Configure bugmail: http://d.puremagic.com/issues/userprefs.cgi?tab=email > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter. >
Comment #8 by matti.niemenmaa+dbugzilla — 2008-03-09T03:46:35Z
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");
Comment #9 by Hans-Werner.Krause — 2008-03-09T04:39:32Z
I just compiled it with dmd 1.028. The result is the same. It looks like the problem is in Phobos. ----- Original Message ----- From: <[email protected]> To: <[email protected]> Sent: Saturday, March 08, 2008 10:01 PM Subject: [Issue 1716] Access Violation at readln > http://d.puremagic.com/issues/show_bug.cgi?id=1716 > > > > > > ------- Comment #6 from [email protected] 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. > > > -- > Configure bugmail: http://d.puremagic.com/issues/userprefs.cgi?tab=email > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter. >
Comment #10 by Hans-Werner.Krause — 2008-03-09T04:43:20Z
Thank you and i'm sorry for my mistake. ----- Original Message ----- From: <[email protected]> To: <[email protected]> Sent: Sunday, March 09, 2008 9:46 AM Subject: [Issue 1716] Access Violation at readln > http://d.puremagic.com/issues/show_bug.cgi?id=1716 > > > [email protected] changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Status|NEW |RESOLVED > Keywords|EH | > Resolution| |INVALID > > > > > ------- Comment #8 from [email protected] 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"); > > > -- > Configure bugmail: http://d.puremagic.com/issues/userprefs.cgi?tab=email > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter. >
Comment #11 by Hans-Werner.Krause — 2008-03-09T04:43:20Z
I just compiled it with dmd 1.028. The result is the same. It looks like the problem is in Phobos. ----- Original Message ----- From: <[email protected]> To: <[email protected]> Sent: Saturday, March 08, 2008 10:01 PM Subject: [Issue 1716] Access Violation at readln > http://d.puremagic.com/issues/show_bug.cgi?id=1716 > > > > > > ------- Comment #6 from [email protected] 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. > > > -- > Configure bugmail: http://d.puremagic.com/issues/userprefs.cgi?tab=email > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter. >
Comment #12 by gide — 2009-05-06T04:54:31Z
*** Bug 1706 has been marked as a duplicate of this bug. ***