Hi,I looked at the generated assembly and don't see anything weird. As you said it might be a strange mismatch between compile time and runtime libc.A stacktrace would help.ArisEnvoyé depuis mon smartphone Samsung Galaxy. -------- Message d'origine --------De : "Skalák, Zdeněk" <zska...@monetplus.cz> Date : 15/01/20 10:03 (GMT+01:00) À : libssh@libssh.org Objet : Re: Strange Segfault with V 0.9.3 an MinGW Cross Compile Hello,On Wed, Jan 15, 2020 at 9:48 AM <g4-l...@tonarchiv.ch> wrote:On 15.01.20 08:27, Andreas Schneider wrote:
> On Wednesday, 15 January 2020 01:22:13 CET g4-l...@tonarchiv.ch wrote: >> I cross compiled V 0.9.3 with MinGW on Ubuntu. The compilation worked >> flawlessly. >> >> But when I run my code linked to the resulting libssh.dll, it crashes >> immediately when I set verbosity to > 2. >> >> I could track this down to vsnprintf() which is called through line 865 >> in channels.c: >> >> SSH_LOG(SSH_LOG_PACKET, >> "placing %zu bytes into channel buffer (%s)", >> len, >> s_stderr ? "stderr" : "stdout"); > Try s_stderr -> is_stderr Hi Andreas, Haha that would be a silly issue, when the compiler would not complain about this... Sorry, I somehow lost the 'i' when I pasted the code into the mail.I can imagine two things which could went wrong:a) libstdc (or whomever implements the vsnprintf()) doesn't know the `%zu` format, so this one is skipped and the `len` argument is used for the (%s) formatb) 32/64 bit mismatch - the format (count of bytes) of the `len` on the stack doesn't correspond to the format (count of bytes) of the `%zu` specifier, so for the second (%s) format, some `grabage from the stack` is usedBoth these two scenarios can lead to mysterious crashes ....RegardsZdenek OGAR Skalak Cheers, Till -- Ing. Zdeněk OGAR SkalákMonet+ a.s. <http://www.monetplus.cz>Za Dvorem 505, 763 14 Zlín - Štípa, CZTel: +420 / 577 110 411, Fax: +420 / 577 914 557