Page MenuHomePhabricator

Access violation with MinGW-W64
Closed, ResolvedPublic

Description

In the current master branch, the format specifier "%zu" is used in "channels.c".

SSH_LOG(SSH_LOG_PACKET,
          "placing %to bytes into channel buffer (%s)"
          len,
          is_stderr ? "stderr" : "stdout");

"%zu" is supported from Visual Studio 2013 on, but MinGW-W64 uses the msvcrt.dll ( on my system Windows 8.1 this is version 7.0.9600.17415 ) and with this version "%zu" is not supported. This will probably be the old Visual Studio 6 Runtime.

So you get an access violation if you run libssh with the loglevel "SSH_LOG_PACKET or SSH_LOG_DEBUG".

To use the format specifier "%zu" with the MinGW the compiler flag "__USE_MINGW_ANSI_STDIO" must be set.

Use "__USE_MINGW_ANSI_STDIO" :

Use "-Dsnprintf=mingw_snprintf -Dvsnprintf=mingw_vsnprintf "

Use "_POSIX"

Use "_POSIX_SOURCE"

Revisions and Commits

Event Timeline

davidwed created this task.Tue, May 5, 2:57 PM
davidwed updated the task description. (Show Details)Tue, May 5, 3:02 PM
davidwed renamed this task from Access violation with MinGW to Access violation with MinGW64.Thu, May 7, 4:49 PM
davidwed updated the task description. (Show Details)
davidwed renamed this task from Access violation with MinGW64 to Access violation with MinGW-W64.Thu, May 7, 4:52 PM
davidwed updated the task description. (Show Details)
davidwed updated the task description. (Show Details)Mon, May 11, 12:36 AM
davidwed updated the task description. (Show Details)Mon, May 11, 8:32 AM
davidwed updated the task description. (Show Details)Fri, May 15, 11:09 AM