vonKingsley/ssh2.cr

Invalid memory access in example when the file doesn't exist

Opened this issue · 0 comments

Invalid memory access (signal 11) at address 0x0
[0x10c3d041b] *CallStack::print_backtrace:Int32 +107
[0x10c3b6cd8] __crystal_sigfault_handler +72
[0x7fff6b35df5a] _sigtramp +26
[0x10c4d3dca] libssh2_sftp_close_handle +162
[0x10c418f64] *SSH2::SFTP::Dir@SSH2::SFTP::Node#close:(Int32 | Nil) +180
[0x10c418e82] *SSH2::SFTP::Dir@SSH2::SFTP::Base#finalize:(Int32 | Nil) +66
[0x10c3b8289] ~proc3Proc(Pointer(Void), Pointer(Void), (Int32 | Nil))@/usr/local/Cellar/crystal-lang/0.24.1_2/src/gc/boehm.cr:114 +25
[0x10c4f27d5] GC_invoke_finalizers +170
[0x10c4f28fe] GC_notify_or_invoke_finalizers +125
[0x10c4f3cf5] GC_generic_malloc +37
[0x10c4f3f68] GC_malloc_kind_global +228
[0x10c4f4472] GC_realloc +210
[0x10c3d1cd9] *GC::realloc<Pointer(Void), UInt64>:Pointer(Void) +9
[0x10c3a8a50] __crystal_realloc64 +32
[0x10c3f8e5c] *Pointer(Debug::DWARF::LineNumbers::Row)@Pointer(T)#realloc<Int32>:Pointer(Debug::DWARF::LineNumbers::Row) +76
[0x10c3f8776] *Array(Debug::DWARF::LineNumbers::Row)@Array(T)#resize_to_capacity<Int32>:Pointer(Debug::DWARF::LineNumbers::Row) +38
[0x10c3f8747] *Array(Debug::DWARF::LineNumbers::Row)@Array(T)#double_capacity:Pointer(Debug::DWARF::LineNumbers::Row) +55
[0x10c3f86ed] *Array(Debug::DWARF::LineNumbers::Row)@Array(T)#check_needs_resize:(Pointer(Debug::DWARF::LineNumbers::Row) | Nil) +29
[0x10c3f8657] *Array(Debug::DWARF::LineNumbers::Row)@Array(T)#push<Debug::DWARF::LineNumbers::Row>:Array(Debug::DWARF::LineNumbers::Row) +119
[0x10c3f85d2] *Array(Debug::DWARF::LineNumbers::Row)@Array(T)#<<<Debug::DWARF::LineNumbers::Row>:Array(Debug::DWARF::LineNumbers::Row) +146
[0x10c3f5065] *Debug::DWARF::LineNumbers#register_to_matrix<Debug::DWARF::LineNumbers::Sequence, Debug::DWARF::LineNumbers::Register>:Nil +1397
[0x10c3f38e9] *Debug::DWARF::LineNumbers#read_statement_program<Debug::DWARF::LineNumbers::Sequence>:Nil +2137
[0x10c3f26fb] *Debug::DWARF::LineNumbers#decode_sequences<UInt64>:Nil +3259
[0x10c3f1a39] *Debug::DWARF::LineNumbers#initialize<IO::FileDescriptor+, UInt64>:Nil +105
[0x10c3f198e] *Debug::DWARF::LineNumbers::new<IO::FileDescriptor+, UInt64>:Debug::DWARF::LineNumbers +110
[0x10c3c8fb7] *CallStack::read_dwarf_sections:(Array(Tuple(UInt64, UInt64, String)) | Nil) +48359
[0x10c3bd0c3] *CallStack::decode_line_number<UInt64>:Tuple(String | Nil, Int32, Int32) +51
[0x10c3bc920] *CallStack#decode_backtrace:Array(String) +288
[0x10c3bc7e1] *CallStack#printable_backtrace:Array(String) +49
[0x10c3ea148] *Exception+@Exception#backtrace?:(Array(String) | Nil) +72
[0x10c3e9b9e] *Exception+@Exception#inspect_with_backtrace<IO::FileDescriptor>:IO::FileDescriptor +110
[0x10c4194ae] *Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32 +142
[0x10c3b3a59] main +9

the following will work (at least gives the correct Exception without invalid memory access)

op = sftp.open_dir(".")
op.ll do |fn|
  puts fn
end
op.close
file = sftp.open(".unknown_file")