1.5.19-4 & snapshot-20060529 : crash when freeing null std::string in dll

LenX lenx.wei@gmail.com
Wed May 31 18:28:00 GMT 2006


hi,

Cygwin version: 1.5.19-4 and snapshot-20060529(1.5.20)

The testcase is in the attachment cyg_dll.tar.bz2

There are one dll file (mydll.cpp) and two main file (myprog_good.cpp and myprog_bad.cpp).

The file 'compile' is a quick script to compile and to generate 3 programs: myprog_good, myprog_bad, myprog_static.

The only difference between myprog_good.cpp and myprog_bad.cpp is

$ diff -u myprog_good.cpp myprog_bad.cpp
--- myprog_good.cpp     2006-06-01 02:01:11.796875000 +0800
+++ myprog_bad.cpp      2006-06-01 02:01:20.375000000 +0800
@@ -7,7 +7,7 @@

 int main()
 {
-    outer x("2");
+    outer x("");

     x.set("3");

myprog_good and myprog_bad use dynamic linking, while myprog_static uses static linking.

And, here are results of those programs:

$ ./myprog_good
3

$ ./myprog_static
3

$ ./myprog_bad
Aborted (core dumped)

So, here is the bug: when you free a null std::string object ("") from dll in my case, it just crashes.

Very strange, huh?

--
lenx
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cyg_dll.tar.bz2
Type: application/octet-stream
Size: 345525 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20060531/39be03f8/attachment.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20060531/39be03f8/attachment.ksh>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list