[Issue 348] New: string concat in dynamically loaded dll code crashes program

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 14 14:06:11 PDT 2006


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

           Summary: string concat in dynamically loaded dll code crashes
                    program
           Product: D
           Version: 0.165
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: default_357-line at yahoo.de


A string concat in a dynamically loaded C linkage function crashes the program
with a SIGSEGV in _d_new (wtf)
Files:
_dll.d_
extern (C) { void test(char[] str) { char[] e=str~"bla"; } }
_test.d_
import std.c.windows.windows;

void main() {
  auto func=cast(void function(char[])) GetProcAddress(LoadLibraryA("dll.dll"),
"test");
  func("Bla bla bla ");
}

On gdcwin 0.19, this crashes with a SIGSEGV trying to access 0x0.
The stack trace is:
#0  0x610c1adb in _d_new ()
#1  0x610c1289 in _d_arraycatn ()
#2  0x610c1214 in test (str={length = 12, ptr = 0x41d00d "Bla bla bla "})
    at dll.d:1
#3  0x00401321 in _Dmain () at quick.d:5
#4  0x004013df in _d_run_main2goFZv ()
#5  0x004014e4 in _d_run_main ()
#6  0x00401363 in main ()


-- 




More information about the Digitalmars-d-bugs mailing list