aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: aMuleCMD 2.2.6 crashes on show ul  (Read 4954 times)

vdb

  • Full Member
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 215
aMuleCMD 2.2.6 crashes on show ul
« on: November 25, 2009, 10:34:59 PM »

amulecmd is compiled on Solaris 10 u8. It crashes on the "show ul" command.

Code: [Select]
Starting program: /usr/local/bin/amulecmd
warning: Temporarily disabling breakpoints for unloaded shared library "/usr/lib/ld.so.1"
warning: Lowest section in /usr/lib/libpthread.so.1 is .dynamic at 00000074
This is amulecmd 2.2.6

Creating client...
Succeeded! Connection established to aMule 2.2.6

---------------------------------------
|          aMule text client          |
---------------------------------------

Use 'Help' for command list

aMulecmd$ show ul
 >    <client 1>  <file 1> 0 bytes3.33 kB/s
 >    <client 2>  <file 2> 0 bytes 3.59 kB/s
 >    <client 3>  <file 3>  14.64 MB 3.44 kB/s

Program received signal SIGSEGV, Segmentation fault.
0xfe9d5a6c in strlen () from /usr/lib/libc.so.1
(gdb) bt
#0  0xfe9d5a6c in strlen () from /usr/lib/libc.so.1
#1  0xfea30522 in _ndoprnt () from /usr/lib/libc.so.1
#2  0xfea331e0 in printf () from /usr/lib/libc.so.1
#3  0x08082e57 in CaMuleExternalConnector::Show (this=0x80f6d30, s=@0x80473a0)
    at ExternalConnector.cpp:228
#4  0x080834d9 in CaMuleExternalConnector::Process_Answer (this=0x80f6d30,
    answer=@0x80475a0) at ExternalConnector.cpp:250
#5  0x0807bb3f in CamulecmdApp::Process_Answer_v2 (this=0x80f6d30,
    response=0x812a328) at TextClient.cpp:830
#6  0x08079264 in CamulecmdApp::ProcessCommand (this=0x80f6d30, CmdId=28)
    at TextClient.cpp:564
#7  0x08083731 in CaMuleExternalConnector::Parse_Command (this=0x80f6d30,
    buffer=@0x8047970) at ExternalConnector.cpp:265
#8  0x08083d90 in CaMuleExternalConnector::TextShell (this=0x80f6d30,
    prompt=@0x8047b80) at ExternalConnector.cpp:341
#9  0x08076123 in CamulecmdApp::TextShell (this=0x80f6d30, prompt=@0x8047b80)
    at TextClient.cpp:149
#10 0x080844ed in CaMuleExternalConnector::ConnectAndRun (this=0x80f6d30,
    ProgName=@0x8047b80, ProgVersion=@0x8047b90) at ExternalConnector.cpp:415
#11 0x080803e1 in CamulecmdApp::OnRun (this=0x80f6d30) at TextClient.cpp:967
#12 0xfee6d9a2 in wxEntry () from /usr/local/lib/libwx_baseu-2.8.so.0.6.0
#13 0xfee6da8f in wxEntry () from /usr/local/lib/libwx_baseu-2.8.so.0.6.0
#14 0x08075f39 in main (argc=1, argv=0x8047c70) at TextClient.cpp:287

Code: [Select]
(gdb) bt full
#0  0xfe9d5a6c in strlen () from /usr/lib/libc.so.1
No symbol table info available.
#1  0xfea30522 in _ndoprnt () from /usr/lib/libc.so.1
No symbol table info available.
#2  0xfea331e0 in printf () from /usr/lib/libc.so.1
No symbol table info available.
#3  0x08082e57 in CaMuleExternalConnector::Show (this=0x80f6d30, s=@0x80473a0)
    at ExternalConnector.cpp:228
No locals.
#4  0x080834d9 in CaMuleExternalConnector::Process_Answer (this=0x80f6d30,
    answer=@0x80475a0) at ExternalConnector.cpp:250
        tokens = {<> = {<No data fields>}, m_string = {<wxStringBase> = {
      static npos = 4294967295, m_pchData = 0x81397a4}, <No data fields>},
  m_delims = {<wxStringBase> = {static npos = 4294967295,
      m_pchData = 0x8138d04}, <No data fields>}, m_pos = 340,
  m_mode = wxTOKEN_STRTOK, m_lastDelim = 10}
#5  0x0807bb3f in CamulecmdApp::Process_Answer_v2 (this=0x80f6d30,
    response=0x812a328) at TextClient.cpp:830
        s = {<wxStringBase> = {static npos = 4294967295,
    m_pchData = 0x8138e3c}, <No data fields>}
        msgFailedUnknown = {<wxStringBase> = {static npos = 4294967295,
    m_pchData = 0x81376dc}, <No data fields>}
#6  0x08079264 in CamulecmdApp::ProcessCommand (this=0x80f6d30, CmdId=28)
---Type <return> to continue, or q <return> to quit---
    at TextClient.cpp:564
        curr = (CECPacket *) 0x8136df8
        reply = (const CECPacket *) 0x812a328
        it = {<__gnu_debug::_Safe_iterator_base> = {_M_sequence = 0x8047818,
    _M_version = 1, _M_prior = 0x0, _M_next = 0x0}, _M_current = {
    _M_node = 0x8047810}}
        request = (CECPacket *) 0x0
        request_list = {<__gnu_norm::list<CECPacket*,std::allocator<CECPacket*> >> = {<__gnu_norm::_List_base<CECPacket*,std::allocator<CECPacket*> >> = {
      _M_impl = {<std::allocator<__gnu_norm::_List_node<CECPacket*> >> = {<__gnu_cxx::new_allocator<__gnu_norm::_List_node<CECPacket*> >> = {<No data fields>}, <No data fields>}, _M_node = {_M_next = 0x8126490,
          _M_prev = 0x8126490}}}, <No data fields>}, <__gnu_debug::_Safe_sequence<__gnu_debug_def::list<CECPacket*, std::allocator<CECPacket*> > >> = {<__gnu_debug::_Safe_sequence_base> = {_M_iterators = 0x80477d0,
      _M_const_iterators = 0x0,
      _M_version = 1}, <No data fields>}, <No data fields>}
        tmp_int = 0
        search_type = EC_SEARCH_KAD
        args = {<wxStringBase> = {static npos = 4294967295,
    m_pchData = 0xfeeee168}, <No data fields>}
#7  0x08083731 in CaMuleExternalConnector::Parse_Command (this=0x80f6d30,
    buffer=@0x8047970) at ExternalConnector.cpp:265
---Type <return> to continue, or q <return> to quit---
        cmd = {<wxStringBase> = {static npos = 4294967295,
    m_pchData = 0x8134ebc}, <No data fields>}
        tokens = {<> = {<No data fields>}, m_string = {<wxStringBase> = {
      static npos = 4294967295, m_pchData = 0x8134f24}, <No data fields>},
  m_delims = {<wxStringBase> = {static npos = 4294967295,
      m_pchData = 0x8129f5c}, <No data fields>}, m_pos = 8,
  m_mode = wxTOKEN_STRTOK, m_lastDelim = 10}
        cmd_ID = 28
        error = {<wxStringBase> = {static npos = 4294967295,
    m_pchData = 0x8134ebc}, <No data fields>}
#8  0x08083d90 in CaMuleExternalConnector::TextShell (this=0x80f6d30,
    prompt=@0x8047b80) at ExternalConnector.cpp:341
        buffer = "show ul\n\000y\004\bÐ\232\t\b\210\236\022\b\000¡\022\b\n\000\000\000'\000\000\000háîþ\020z\004\bÈy\004\b\223\231\t\b\220z\004\b z\004\b¨z\004\b\0263\b\b z\004\b\020{\004\b¨z\004\bú3\b\b\220z\004\b\020z\004\b\224\236\022\b\000\000\000\000\000\000\000\000à\233\022\b\020z\004\b`z\004\b z\004\b0z\004\bpz\004\b`z\004\bPz\004\bÐõ¬þ`z\004\bpz\004\b<\237\022\bÐõ¬þ\000à¬þÐõ¬þ\034\000\000\000\034\000\000\000\000\000\000\000ì\223\022\b<\237\022\bHz\004\b\021S\237þÐõ¬þì\223\022\b\020{\004\b"...
        buf = {<wxStringBase> = {static npos = 4294967295,
    m_pchData = 0x8129e94}, <No data fields>}
        The_End = false
#9  0x08076123 in CamulecmdApp::TextShell (this=0x80f6d30, prompt=@0x8047b80)
---Type <return> to continue, or q <return> to quit---
    at TextClient.cpp:149
No locals.
#10 0x080844ed in CaMuleExternalConnector::ConnectAndRun (this=0x80f6d30,
    ProgName=@0x8047b80, ProgVersion=@0x8047b90) at ExternalConnector.cpp:415
        appName = {<wxStringBase> = {static npos = 4294967295,
    m_pchData = 0x81277e4}, <No data fields>}
#11 0x080803e1 in CamulecmdApp::OnRun (this=0x80f6d30) at TextClient.cpp:967
No locals.
#12 0xfee6d9a2 in wxEntry () from /usr/local/lib/libwx_baseu-2.8.so.0.6.0
No symbol table info available.
#13 0xfee6da8f in wxEntry () from /usr/local/lib/libwx_baseu-2.8.so.0.6.0
No symbol table info available.
#14 0x08075f39 in main (argc=1, argv=0x8047c70) at TextClient.cpp:287
No locals.

Code: [Select]
(gdb) thread apply all bt

Thread 1 (LWP 1):
#0  0xfe9d5a6c in strlen () from /usr/lib/libc.so.1
#1  0xfea30522 in _ndoprnt () from /usr/lib/libc.so.1
#2  0xfea331e0 in printf () from /usr/lib/libc.so.1
#3  0x08082e57 in CaMuleExternalConnector::Show (this=0x80f6d30, s=@0x80473a0)
    at ExternalConnector.cpp:228
#4  0x080834d9 in CaMuleExternalConnector::Process_Answer (this=0x80f6d30,
    answer=@0x80475a0) at ExternalConnector.cpp:250
#5  0x0807bb3f in CamulecmdApp::Process_Answer_v2 (this=0x80f6d30,
    response=0x812a328) at TextClient.cpp:830
#6  0x08079264 in CamulecmdApp::ProcessCommand (this=0x80f6d30, CmdId=28)
    at TextClient.cpp:564
#7  0x08083731 in CaMuleExternalConnector::Parse_Command (this=0x80f6d30,
    buffer=@0x8047970) at ExternalConnector.cpp:265
#8  0x08083d90 in CaMuleExternalConnector::TextShell (this=0x80f6d30,
    prompt=@0x8047b80) at ExternalConnector.cpp:341
#9  0x08076123 in CamulecmdApp::TextShell (this=0x80f6d30, prompt=@0x8047b80)
    at TextClient.cpp:149
#10 0x080844ed in CaMuleExternalConnector::ConnectAndRun (this=0x80f6d30,
    ProgName=@0x8047b80, ProgVersion=@0x8047b90) at ExternalConnector.cpp:415
#11 0x080803e1 in CamulecmdApp::OnRun (this=0x80f6d30) at TextClient.cpp:967
#12 0xfee6d9a2 in wxEntry () from /usr/local/lib/libwx_baseu-2.8.so.0.6.0
---Type <return> to continue, or q <return> to quit---
#13 0xfee6da8f in wxEntry () from /usr/local/lib/libwx_baseu-2.8.so.0.6.0
#14 0x08075f39 in main (argc=1, argv=0x8047c70) at TextClient.cpp:287

Anything somebody can do with this information?
« Last Edit: November 26, 2009, 11:24:05 AM by Kry »
Logged
A waste is a terrible thing to mind.

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: aMuleCMD 2.2.6 crashes on show ul
« Reply #1 on: November 27, 2009, 05:21:21 PM »

Well, 3 uploads were shown and then it crashed. It's probably related to the name of the 4th upload (client or file).
If it happens again try to check the names. Probably some strange special character.
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

vdb

  • Full Member
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 215
Re: aMuleCMD 2.2.6 crashes on show ul
« Reply #2 on: November 28, 2009, 03:16:08 PM »

Interesting, yes, now it does NOT crash.

Related to the Solaris implementation of iconv perhaps?
Logged
A waste is a terrible thing to mind.

^marcell^

  • Developer
  • Hero Member
  • *****
  • Karma: 28
  • Offline Offline
  • Posts: 524
Re: aMuleCMD 2.2.6 crashes on show ul
« Reply #3 on: November 28, 2009, 11:53:08 PM »

Here's the method where the segmentation fault occurs:
Code: [Select]
void CaMuleExternalConnector::Show(const wxString &s)
{
if( !m_KeepQuiet ) {
printf("%s", (const char *)unicode2char(s));
#ifdef __WXMSW__
fflush(stdout);
#endif
}
}

Seems like the pointer returned by "uncode2char" is invalid. Here's a snippet from "libs/common/StringFunctions.h":
Code: [Select]
* Please, DO NOT store pointers returned by unicode2char(), because they
 * get free'ed as soon as the return value of cWX2MB gets out of scope.
 * If you need to store a pointer, use a buffer of type wxWX2MBbuf:
 * and then cast it to a char pointer, e.g.:
 *
 * const wxWX2MBbuf buf(unicode2char(aWxString));
Since I have no clude what "as soon as the return value of cWX2MB gets out of scope" should mean, I can't tell whether it's a problem how the pointer is simply handed over to "printf". Maybe someone with more WX experience can tell us.

The strange thing is that I can't find the "unicode2char" implementation anywhere, so I am unable to check if there's a problem in it considering "strange special characters" as Stu called them. Anyway it would be interesting to know what character is causing this memory access failure.
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: aMuleCMD 2.2.6 crashes on show ul
« Reply #4 on: November 29, 2009, 12:37:28 AM »

Here's the method where the segmentation fault occurs:
Code: [Select]
void CaMuleExternalConnector::Show(const wxString &s)
{
if( !m_KeepQuiet ) {
printf("%s", (const char *)unicode2char(s));
That's the standard code for printfing wxStrings. If there were such a fundamental problem with it we would know.  ;)
Quote
The strange thing is that I can't find the "unicode2char" implementation anywhere
It's right below the lines of comment you quoted.
Code: [Select]
inline Unicode2CharBuf unicode2char(const wxChar* x) { return wxConvLocal.cWX2MB(x); }
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon