cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl 7.37.1 and OpenSSL 1.0.1h: crashes on initialization on certain Windows 7 systems

From: Ulrich Telle <Ulrich.Telle_at_gmx.de>
Date: Thu, 14 Aug 2014 23:38:39 +0200

Hi Ray,

> On 8/14/2014 2:34 PM, Ulrich Telle wrote:
> > Recently I upgraded to libcurl 7.37.1 and OpenSSL 1.0.1h. Now my
> > application doesn't start anymore, but terminates immediately with a
> > process exit code of 1 (0x1) without showing any error message.
> > However, this happens only on certain Windows 7 system, namely Windows
> > 7 Enterprise 32-Bit and 64-Bit. The same application properly starts
> > on Windows 7 Professional 32-Bit and 64-Bit.
> >
> > The application exits during executing curl_global_init, that is,
> > function curl_global_init does not return. I suspect that the problem
> > is related to OpenSSL, although I'm not sure about that.
>
> What are you passing to curl_global_init()? Please review:
> http://curl.haxx.se/libcurl/c/curl_global_init.html

curl_global_init(CURL_GLOBAL_ALL);

> If you can provide a small sample that demonstrates the problem I will
> try to reproduce. Please include the commands you used to build the
> sample.

The call to curl_global_init is almost the first thing taking place in my
application. I added log messages before and after the call. Only the one
before was written to the log file. curl_global_init did not return.

> Where did you get libcurl and OpenSSL?

I downloaded the source code packages from
http://curl.haxx.se/download.html resp http://www.openssl.org/source/

> Did you build them yourself and if so how?

Yes, I built the libraries myself using Visual C++ 2010. I followed the
instructions described in the following document:

http://curl.haxx.se/libcurl/c/Using-libcurl-with-SSH-support-in-Visual-Studio-2
010.pdf

I applied a small change to libcurl's file easy.c to account for an OpenSSL
memory leak. However, this can't be the cause of the problem, because this
added code gets only executed when function curl_global_cleanup gets
called.

I used this procedure since I started to develop the application about 3 years
ago. I started with libcurl 7.26.0 and OpenSSL 1.0.1c. The application
worked flawlessly all over the last 3 years. Only after I upgraded to libcurl
7.37.1 and OpenSSL 1.0.1h, the problems started to show up. However, not
on all Windows 7 systems, especially not on my development system. I got a
report from a user that the application doesn't start anymore. This forced me
to investigate the issue.

> The more information you give us the easier it
> will be to figure out what's happening.

A few minutes ago I found the following bug report:

http://sourceforge.net/p/curl/bugs/1401/#1be6

For me it sounds like the problem with my application is very similar. At some
place in the above thread a call to exit(1) is mentioned. And that's exactly
what seems to happen, since the application terminates with exit code 1.

According to the above mentioned thread there seem to be problems coming
from the use of

OPENSSL_config(NULL);

I checked the system where my application terminates. There is no
environment variable OPENSSL_CONF set. The same is true for my
development machine, however, the application works as expected.

I have no idea why my application works on some systems and on some not,
but the best solution probably will be to revert to libcurl 7.37.0, or to apply the
patch mentioned in the thread (I will test that tomorrow), or wait for the next
version on libcurl (hopefully fixing the problem).

> If by chance you're linking to libcurl .a files in Visual Studio don't
> do that. You may experience weird problems like your app spontaneously
> closes or crashes.

No, I'm not using a .a file, since I build libcurl myself.

Regards,

Ulrich

-- 
E-Mail privat:  Ulrich.Telle_at_gmx.de
World Wide Web: http://www.telle-online.de
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-08-14