michaellukashov / Far-NetBox

SFTP/SCP/FTP/FTPS/WebDAV/S3 client for Far Manager 3 (http://farmanager.com/)
https://forum.farmanager.com/viewtopic.php?t=6317
GNU General Public License v2.0
159 stars 52 forks source link

Far silent close upon connection to a FTP server #432

Closed Px-x64 closed 6 months ago

Px-x64 commented 6 months ago

Versions

Far: 3.0.6293.3772 NetBox: 24.3.0.598

Steps to reproduce

  1. Open NetBox panel.
  2. Add following ftp server: ftp://ftp.berklix.org/, specify User Name: anonymous, Password: a@a.a, save the connection.
  3. Connect to the server.

Expected behavior

Connection is established, and I see the list of files on the panel

Actual behavior

Far silently closes. No crash dump from Far itself, no crash dump from external debugger, no any records in system events logs.

I've managed to capture the following stack with WinDBG

eax=00000000 ebx=ffffff6f ecx=00000000 edx=00000000 esi=c0000417 edi=045bf9a0
eip=7799fcf2 esp=045bf93c ebp=045bf94c iopl=0         nv up ei pl zr na pe nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000246
ntdll!ZwTerminateProcess+0x12:
7799fcf2 83c404          add     esp,4

0:013> k
 # ChildEBP RetAddr  
00 045bf93c 75ecf3c8 ntdll!ZwTerminateProcess+0x12
*** WARNING: Unable to verify checksum for M:\Far.x86.3.0.6293.3772.4a52ceab4b3097bff023cd487aaa09f35c1d3e6b\Plugins\NetBox\NetBox.dll
01 045bf94c 57946537 KERNELBASE!TerminateProcess+0x2c
02 045bf95c 579464d7 NetBox!_invoke_watson+0x32 [minkernel\crts\ucrt\src\appcrt\misc\invalid_parameter.cpp @ 246] 
03 045bf980 5794644e NetBox!_invalid_parameter_internal+0x7c [minkernel\crts\ucrt\src\appcrt\misc\invalid_parameter.cpp @ 113] 
04 045bf9c8 579464e4 NetBox!_invalid_parameter+0x2a [minkernel\crts\ucrt\src\appcrt\misc\invalid_parameter.cpp @ 125] 
05 045bf9e0 579469de NetBox!_invalid_parameter_noinfo+0xc [minkernel\crts\ucrt\src\appcrt\misc\invalid_parameter.cpp @ 130] 
06 045bf9f8 5763bc04 NetBox!common_tcsncpy_s<char>+0x2e [minkernel\crts\ucrt\inc\corecrt_internal_string_templates.h @ 222] 
07 045bfa54 5763d662 NetBox!CFtpListResult::ParseShortDate+0xc4 [D:\a\Far-NetBox\Far-NetBox\src\filezilla\FtpListResult.cpp @ 559] 
08 045bfa7c 57640d4e NetBox!CFtpListResult::parseAsIBMMVS+0xc2 [D:\a\Far-NetBox\Far-NetBox\src\filezilla\FtpListResult.cpp @ 2399] 
09 045bfb04 5763b282 NetBox!CFtpListResult::parseLine+0xfe [D:\a\Far-NetBox\Far-NetBox\src\filezilla\FtpListResult.cpp @ 289] 
0a 045bfbb8 57635b15 NetBox!CFtpListResult::AddData+0x1e2 [D:\a\Far-NetBox\Far-NetBox\src\filezilla\FtpListResult.cpp @ 384] 
0b 045bfc00 57619c74 NetBox!CTransferSocket::OnReceive+0x125 [D:\a\Far-NetBox\Far-NetBox\src\filezilla\TransferSocket.cpp @ 161] 
0c 045bfc54 74ff630a NetBox!CAsyncSocketExHelperWindow::WindowProc+0x1f4 [D:\a\Far-NetBox\Far-NetBox\src\filezilla\AsyncSocketEx.cpp @ 604] 
0d 045bfc80 74ff6d4a USER32!InternalCallWinProc+0x23
0e 045bfcf8 74ff77d7 USER32!UserCallWinProcCheckWow+0x109
0f 045bfd58 74ff789a USER32!DispatchMessageWorker+0x3b5
10 045bfd68 57633fe8 USER32!DispatchMessageW+0xf
11 045bfd9c 576342a9 NetBox!CMainThread::Run+0x88 [D:\a\Far-NetBox\Far-NetBox\src\filezilla\MainThread.cpp @ 428] 
12 045bfda0 77273d05 NetBox!CMainThread::ThreadProc+0x9 [D:\a\Far-NetBox\Far-NetBox\src\filezilla\MainThread.cpp @ 412] 
13 045bfdac 779b9732 kernel32!BaseThreadInitThunk+0xe
14 045bfdec 779b9705 ntdll!__RtlUserThreadStart+0x70
15 045bfe04 00000000 ntdll!_RtlUserThreadStart+0x1b

0:013> !threads
Index   TID         TEB             StackBase           StackLimit          DeAlloc         StackSize           ThreadProc
13  00001b00    0xfff7f000  0x045c0000  0x045be000  0x044c0000  0x00002000  0x0
Total VM consumed by thread stacks 0x00002000

Looks like NetBox didn't like some date in output, and decide to kill everyone around instead of showing an error :)

Px-x64 commented 6 months ago

Alternative server for tests: ftp://internat.freebsd.org/

Px-x64 commented 6 months ago

Filezilla 3.66.5 connects to these servers without issues

Px-x64 commented 6 months ago

Same for WinSCP 6.3.2, no issues with the connection.

Also please see https://github.com/FarGroup/FarManager/issues/816#issuecomment-2013706878 regarding exception handler override to have Far Manager handle the exception gracefully.