I finally was able to compile the Xcode app with libssh2 1.8.0 using
libssh2.a library.
But the app still crashes on attempt to connect to any SFTP server.
Happens on both macOS 10.14 and 10.13.
I attached below the output from Xcode's debugger.
The error happens in libssh2_session_handshake ()
I wonder if anyone can point to any clue in this output that can help
solve the issue?
Any advice will be greatly appreciated.
Thanks,
Leo
?? 0x10006adb4 <+859>:?? movq???? -0x38(%rbp), %r15
?????? 0x10006adb8 <+863>:?? jne?????? 0x10006b027???????????????????????????? ;
<+1486>
?????? 0x10006adbe <+869>:?? movq???? 0xe8(%r13), %rsi
?????? 0x10006adc5 <+876>:?? movl???? $0x4, %edx
?????? 0x10006adca <+881>:?? leaq???? 0x25f7f(%rip), %rdi???????????? ; "SSH-"
?????? 0x10006add1 <+888>:?? callq?? 0x100076922???????????????????????????? ; symbol stub
for: strncmp
?????? 0x10006add6 <+893>:?? testl?? %eax, %eax
?????? 0x10006add8 <+895>:?? jne?????? 0x10006ac5b???????????????????????????? ;
<+514>
?????? 0x10006adde <+901>:?? movl???? $0x4, 0xcc60(%r13)
?????? 0x10006ade9 <+912>:?? xorl???? %esi, %esi
?????? 0x10006adeb <+914>:?? movq???? %r13, %rdi
?????? 0x10006adee <+917>:?? movq???? -0x50(%rbp), %rdx
?????? 0x10006adf2 <+921>:?? callq?? 0x100064350???????????????????????????? ;
_libssh2_kex_exchange
->?? 0x10006adf7 <+926>:?? testl?? %eax, %eax ?????? ?????? ?????? ?????? ?????? ?????? ??????
?????? ?????? ?????? ?????? ?????? ?????? ?????? ?????? Thread 9: EXC_BAD_ACCESS (code=1,
address=0x0)
?????? 0x10006adf9 <+928>:?? je???????? 0x10006ae61???????????????????????????? ;
<+1032>
?????? 0x10006adfb <+930>:?? movq???? %r13, %rdi
?????? 0x10006adfe <+933>:?? movl???? %eax, %esi
?????? 0x10006ae00 <+935>:?? leaq???? 0x25f4e(%rip), %rdx???????????? ; "Unable to
exchange encryption keys"
?????? 0x10006ae07 <+942>:?? jmp?????? 0x10006b031???????????????????????????? ;
<+1496>
?????? 0x10006ae0c <+947>:?? testq?? %rax, %rax
?????? 0x10006ae0f <+950>:?? leaq???? 0x286(%rip), %rbx???????????????? ;
<+1603>
?????? 0x10006ae16 <+957>:?? jns?????? 0x10006afa3???????????????????????????? ;
<+1354>
?????? 0x10006ae1c <+963>:?? cmpq???? $-0x23, %rax
?????? 0x10006ae20 <+967>:?? je???????? 0x10006afa3???????????????????????????? ;
<+1354>
?????? 0x10006ae26 <+973>:?? movl???? $0x0, 0xcb38(%r13)
?????? 0x10006ae31 <+984>:?? movl???? $0xffffffd5, %esi???????????????? ; imm =
0xFFFFFFD5
?????? 0x10006ae36 <+989>:?? xorl???? %ecx, %ecx
?????? 0x10006ae38 <+991>:?? jmp?????? 0x10006afbf???????????????????????????? ;
<+1382>
?????? 0x10006ae3d <+996>:?? movl???? $0x0, 0xcb38(%r13)
?????? 0x10006ae48 <+1007>: movq???? $0x0, 0xcc40(%r13)
?????? 0x10006ae53 <+1018>: movl???? $0xfffffffe, %esi???????????????? ; imm =
0xFFFFFFFE
?????? 0x10006ae58 <+1023>: movq???? -0x38(%rbp), %r15
?????? 0x10006ae5c <+1027>: jmp?????? 0x10006b027???????????????????????????? ;
<+1486>
?????? 0x10006ae61 <+1032>: movl???? $0x5, 0xcc60(%r13)
?????? 0x10006ae6c <+1043>: movb???? $0x5, 0xcc78(%r13)
?????? 0x10006ae74 <+1051>: movl???? $0xc, %esi
?????? 0x10006ae79 <+1056>: movq???? -0x68(%rbp), %rdi
?????? 0x10006ae7d <+1060>: callq?? 0x100068baf???????????????????????????? ;
_libssh2_htonu32
?????? 0x10006ae82 <+1065>: movq???? -0x60(%rbp), %rax
?????? 0x10006ae86 <+1069>: movabsq $0x726573752d687373, %rcx ; imm =
0x726573752D687373
?????? 0x10006ae90 <+1079>: movq???? %rcx, (%rax)
?????? 0x10006ae93 <+1082>: movl???? $0x68747561, 0x8(%rax)?????? ; imm =
0x68747561
?????? 0x10006ae9a <+1089>: movl???? $0x6, 0xcc60(%r13)
?????? 0x10006aea5 <+1100>: movl???? $0x11, %edx
?????? 0x10006aeaa <+1105>: xorl???? %ecx, %ecx
?????? 0x10006aeac <+1107>: xorl???? %r8d, %r8d
?????? 0x10006aeaf <+1110>: movq???? %r13, %rdi
?????? 0x10006aeb2 <+1113>: movq???? -0x88(%rbp), %rsi
?????? 0x10006aeb9 <+1120>: callq?? 0x1000732f3???????????????????????????? ;
_libssh2_transport_send
?????? 0x10006aebe <+1125>: testl?? %eax, %eax
?????? 0x10006aec0 <+1127>: je???????? 0x10006aed3???????????????????????????? ;
<+1146>
?????? 0x10006aec2 <+1129>: movq???? %r13, %rdi
?????? 0x10006aec5 <+1132>: movl???? %eax, %esi
?????? 0x10006aec7 <+1134>: leaq???? 0x25eb7(%rip), %rdx???????????? ; "Unable to
ask for ssh-userauth service"
?????? 0x10006aece <+1141>: jmp?????? 0x10006b031???????????????????????????? ;
<+1496>
?????? 0x10006aed3 <+1146>: movl???? $0x7, 0xcc60(%r13)
?????? 0x10006aede <+1157>: movl???? $0x6, %esi
?????? 0x10006aee3 <+1162>: xorl???? %r8d, %r8d
??0x10006aee6 <+1165>: xorl???? %r9d, %r9d
?????? 0x10006aee9 <+1168>: movq???? %r13, %rdi
?????? 0x10006aeec <+1171>: movq???? -0x80(%rbp), %rdx
?????? 0x10006aef0 <+1175>: movq???? -0x78(%rbp), %rcx
?????? 0x10006aef4 <+1179>: pushq?? -0x70(%rbp)
?????? 0x10006aef7 <+1182>: pushq?? $0x0
?????? 0x10006aef9 <+1184>: callq?? 0x10006a2a6???????????????????????????? ;
_libssh2_packet_require
?????? 0x10006aefe <+1189>: addq???? $0x10, %rsp
?????? 0x10006af02 <+1193>: testl?? %eax, %eax
?????? 0x10006af04 <+1195>: jne?????? 0x10006b036???????????????????????????? ;
<+1501>
?????? 0x10006af0a <+1201>: movq???? 0xcc68(%r13), %rdi
?????? 0x10006af11 <+1208>: incq???? %rdi
?????? 0x10006af14 <+1211>: callq?? 0x100068b99???????????????????????????? ;
_libssh2_ntohu32
?????? 0x10006af19 <+1216>: movl???? %eax, %edx
?????? 0x10006af1b <+1218>: movq???? %rdx, 0xcc90(%r13)
?????? 0x10006af22 <+1225>: movq???? 0xcc68(%r13), %r14
?????? 0x10006af29 <+1232>: cmpl???? $0xc, %eax
?????? 0x10006af2c <+1235>: jne?????? 0x10006af46???????????????????????????? ;
<+1261>
?????? 0x10006af2e <+1237>: leaq???? 0x5(%r14), %rsi
?????? 0x10006af32 <+1241>: leaq???? 0x25e3f(%rip), %rdi???????????? ;
"ssh-userauth"
?????? 0x10006af39 <+1248>: callq?? 0x100076922???????????????????????????? ; symbol stub
for: strncmp
?????? 0x10006af3e <+1253>: testl?? %eax, %eax
?????? 0x10006af40 <+1255>: je???????? 0x10006b078???????????????????????????? ;
<+1567>
?????? 0x10006af46 <+1261>: movq???? %r14, %rdi
?????? 0x10006af49 <+1264>: movq???? %r13, %rsi
?????? 0x10006af4c <+1267>: callq?? *0x18(%r13)
?????? 0x10006af50 <+1271>: movq???? $0x0, 0xcc68(%r13)
?????? 0x10006af5b <+1282>: movl???? $0xfffffff2, %esi???????????????? ; imm =
0xFFFFFFF2
?????? 0x10006af60 <+1287>: movq???? %r13, %rdi
?????? 0x10006af63 <+1290>: leaq???? 0x25e42(%rip), %rdx???????????? ; "Invalid
response received from server"
?????? 0x10006af6a <+1297>: jmp?????? 0x10006b031???????????????????????????? ;
<+1496>
?????? 0x10006af6f <+1302>: cmpl???? $-0x23, %eax
?????? 0x10006af72 <+1305>: movq???? -0x38(%rbp), %r15
?????? 0x10006af76 <+1309>: leaq???? 0x11f(%rip), %rbx???????????????? ; <+1603>
?????? 0x10006af7d <+1316>: jne?????? 0x10006b00c???????????????????????????? ;
<+1459>
?????? 0x10006af83 <+1322>: movl???? $0x1, 0x208(%r13)
?????? 0x10006af8e <+1333>: sarq???? $0x20, %r14
?????? 0x10006af92 <+1337>: movq???? %r14, 0xcc40(%r13)
?????? 0x10006af99 <+1344>: movl???? $0xffffffdb, %esi???????????????? ; imm =
0xFFFFFFDB
?????? 0x10006af9e <+1349>: jmp?????? 0x10006b027???????????????????????????? ;
<+1486>
?????? 0x10006afa3 <+1354>: movl???? $0x2, 0x208(%r13)
?????? 0x10006afae <+1365>: testq?? %rax, %rax
?????? 0x10006afb1 <+1368>: jle?????? 0x10006b05a???????????????????????????? ;
<+1537>
?????? 0x10006afb7 <+1374>: addq???? %rax, %rcx
?????? 0x10006afba <+1377>: movl???? $0xffffffdb, %esi???????????????? ; imm =
0xFFFFFFDB
?????? 0x10006afbf <+1382>: movq???? %rcx, 0xcc40(%r13)
?????? 0x10006afc6 <+1389>: movq???? %r13, %rdi
?????? 0x10006afc9 <+1392>: leaq???? 0x25d54(%rip), %rdx???????????? ; "Failed
sending banner"
?????? 0x10006afd0 <+1399>: jmp?????? 0x10006b031???????????????????????????? ;
<+1496>
?????? 0x10006afd2 <+1401>: movl???? $0xffffffff, 0x204(%r13)?? ; imm =
0xFFFFFFFF
?????? 0x10006afdd <+1412>: movl???? $0xfffffff3, %esi???????????????? ; imm =
0xFFFFFFF3
?????? 0x10006afe2 <+1417>: jmp?????? 0x10006afff???????????????????????????? ;
<+1446>
?????? 0x10006afe4 <+1419>: movl???? $0x0, 0xcb38(%r13)
?????? 0x10006afef <+1430>: movq???? $0x0, 0xcc40(%r13)
?????? 0x10006affa <+1441>: movl???? $0xfffffffe, %esi???????????????? ; imm =
0xFFFFFFFE
?????? 0x10006afff <+1446>: movq???? -0x38(%rbp), %r15
?????? 0x10006b003 <+1450>: leaq???? 0x92(%rip), %rbx?????????????????? ;
<+1603>
?????? 0x10006b00a <+1457>: jmp?????? 0x10006b027???????????????????????????? ;
<+1486>
?????? 0x10006b00c <+1459>: movl???? $0x0, 0xcb38(%r13)
?????? 0x10006b017 <+1470>: movq???? $0x0, 0xcc40(%r13)
?????? 0x10006b022 <+1481>: movl???? $0xffffffd5, %esi???????????????? ; imm =
0xFFFFFFD5
?????? 0x10006b027 <+1486>: movq???? %r13, %rdi
?????? 0x10006b02a <+1489>: leaq???? 0x25d09(%rip), %rdx???????????? ; "Failed
getting banner"
?????? 0x10006b031 <+1496>: callq?? 0x100068b00???????????????????????????? ;
_libssh2_error
?????? 0x10006b036 <+1501>: cmpl???? $-0x25, %eax
?????? 0x10006b039 <+1504>: jne?????? 0x10006b069???????????????????????????? ;
<+1552>
?????? 0x10006b03b <+1506>: cmpl???? $0x0, 0x94(%r13)
?????? 0x10006b043 <+1514>: je???????? 0x10006b064???????????????????????????? ;
<+1547>
?????? 0x10006b045 <+1516>: movq???? %r13, %rdi
?????? 0x10006b048 <+1519>: movq???? %r15, %rsi
?????? 0x10006b04b <+1522>: callq?? 0x10006a864???????????????????????????? ;
_libssh2_wait_socket
?????? 0x10006b050 <+1527>: testl?? %eax, %eax
?????? 0x10006b052 <+1529>: je???????? 0x10006aaf5???????????????????????????? ;
<+156>
?????? 0x10006b058 <+1535>: jmp?????? 0x10006b069???????????????????????????? ;
<+1552>
?????? 0x10006b05a <+1537>: movl???? $0xffffffdb, %esi???????????????? ; imm =
0xFFFFFFDB
?????? 0x10006b05f <+1542>: jmp?????? 0x10006afc6???????????????????????????? ;
<+1389>
?????? 0x10006b064 <+1547>: movl???? $0xffffffdb, %eax???????????????? ; imm =
0xFFFFFFDB
?????? 0x10006b069 <+1552>: addq???? $0x68, %rsp
?????? 0x10006b06d <+1556>: popq???? %rbx
?????? 0x10006b06e <+1557>: popq???? %r12
?????? 0x10006b070 <+1559>: popq???? %r13
?????? 0x10006b072 <+1561>: popq???? %r14
?????? 0x10006b074 <+1563>: popq???? %r15
?????? 0x10006b076 <+1565>: popq???? %rbp
?????? 0x10006b077 <+1566>: retq
?????? 0x10006b078 <+1567>: movq???? %r14, %rdi
?????? 0x10006b07b <+1570>: movq???? %r13, %rsi
?????? 0x10006b07e <+1573>: callq?? *0x18(%r13)
?????? 0x10006b082 <+1577>: movq???? $0x0, 0xcc68(%r13)
?????? 0x10006b08d <+1588>: movl???? $0x0, 0xcc60(%r13)
?????? 0x10006b098 <+1599>: xorl???? %eax, %eax
?????? 0x10006b09a <+1601>: jmp?????? 0x10006b069???????????????????????????? ;
<+1552>
?????? 0x10006b09c <+1603>: js???????? 0x10006b098???????????????????????????? ;
<+1599>
On 3/11/19 6:32 AM, Leo wrote:
Hi Peter,
Thank you for the prompt reply!
On 3/7/19 6:25 AM, Peter Stuge wrote:
Leo wrote:
File: kex.c
..
libssh2_sha1_update(fingerprint_ctx,
session->server_hostkey,?? <-------------Thread 1: EXC_BAD_ACCESS
(code=1, address=0x0)
session->server_hostkey_len);
So you could either try to debug this, e.g. by outputing the values of
session, session->server_hostkey and session->server_hostkey_len to a
debug log, or..
The Xcode debugger output for these values is as follows:
successful connection:
session: 0x10288d400
fingerprint_ctx:
session->server_hostkey: ""
session->server_hostkey_len: 279
crash:
session: 0x102213400
fingerprint_ctx:
session->server_hostkey: ""
session->server_hostkey_len: 279
The only difference is the 'session' value. Frankly, I don't know what
that means and if it can help find what causes the crash in the second
project.
Do you have a better idea by any chance?
Some basic project details:
libssh2-1.4.3
..you could just upgrade from this >6 year old version, and see if
your bug has already been fixed.
I had to mention in my original post that it was my first thought, of
course.
I spent a week trying to include the latest version of libssh2 in my
Xcode project - but all attempts to compile, unfortunately, failed.
In a rare case that the project did compile, the app could only run on
the same machine - and crashed on others.
I looked up tons of info on the problems I experienced, as well as the
info on libssh2 implementation in Xcode in general. Still no luck.
After a week I had to give up on that, for now. I decided to first try
to solve the crash with libssh2-1.4.3, if possible - as at least it
compiles and does work in one app.
If I won't be able to solve this crash, then I'll post a separate
question regarding Xcode integration of the current version.
Sincerely,
Leo
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel