cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl + libssh2: strange error on Win64 (compiled using VS 2008)

From: Pierre Joye <pierre.php_at_gmail.com>
Date: Wed, 29 Dec 2010 11:59:35 +0100

hi,

On Wed, Dec 29, 2010 at 1:12 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> I would expect that libssh2 needs something similar to this to start with:
>
> diff --git a/include/libssh2.h b/include/libssh2.h
> index e011d49..1347b74 100644
> --- a/include/libssh2.h
> +++ b/include/libssh2.h
> @@ -122,7 +122,11 @@ typedef unsigned int uint32_t;
>  typedef unsigned __int64 libssh2_uint64_t;
>  typedef __int64 libssh2_int64_t;
>  # ifndef _SSIZE_T_DEFINED
> +#ifdef _WIN64
> +typedef __int64 ssize_t;
> +#else
>  typedef int ssize_t;
> +#endif
>  # define _SSIZE_T_DEFINED
>  #endif
>  #else

I would say SSIZE_T, always on Windows. Both int or __int64 can be wrong.

I made some small tests using libssh2 only. As it works well for small
files, the current master went mad when using n MB data using scp.c
example. I did not experimenent a crash but it goes to an infinite
loop which is very clause to the problem described here (bad casting).

There are many bad automatic casting in libssh2
(http://www.php.net/~pierre/test/BuildLog.htm), as many are surely
false positive I'm sure a couple of them are causing this problem.

Cheers,

--
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-12-29