Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. SIGSEGV Segmentation Fault after connectToHostEncrypted

SIGSEGV Segmentation Fault after connectToHostEncrypted

Scheduled Pinned Locked Moved Solved General and Desktop
18 Posts 4 Posters 4.6k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KapitanF
    wrote on last edited by
    #1

    Hello, help me! I have QT 5.91 Community and after compile/run is application terminated with error SIGSEGV Segmentation Fault after socket->connectToHostEncrypted(host,port). Linux 64bit GCC 7.1.1 . I mean application is OK. OPENSSL is last version 1.0.2. Here is Backtrace output:

    [0_1502507131850_bt1.txt](Uploading 100%)

    Here is Disassembler output:

    [0_1502507221478_DisAssembler.asm](Uploading 100%)

    CPP:

    [0_1502507242750_qtsslreceiver.cpp](Uploading 100%)

    HEADER:

    [0_1502507264725_qtsslreceiver.h](Uploading 100%)

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #16

      Hi
      One thing that i noted.
      you define
      QSslSocket *msocket;
      but do not set to nullptr
      and then use it later

      
      void QtSslReceiver::OnConnect(const QString &hostname,unsigned short port)
      {
          if (!msocket) <<<< Might not be null, might be random value here
          {
              msocket = new QSslSocket(this);
          xx
          }
      
          msocket->ignoreSslErrors(); <<< Might crash here
      
      

      To check if that
      just try
      msocket=nullptr; ( or set it to null in .h)
      OnConnect("kapitanf.ddns.net", 5000);

      Thats stops it crashing here when i run it.

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi and welcome to devnet,

        That doesn't help much, you seem to be trying to show the stack trace of a release build of your application. You should rather start it in debug mode with a debug build.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • K Offline
          K Offline
          KapitanF
          wrote on last edited by
          #3

          Hi, SGaist, thank you for Reply. And here is the problem. I am trying debugging and it behaves like Release. QtCreator say in Debug mode:

          Starting /home/freefilip/build-QtSslReceiver-Unnamed-Debug/QtSslReceiver...
          The program has unexpectedly finished.
          /home/freefilip/build-QtSslReceiver-Unnamed-Debug/QtSslReceiver crashed.

          I dont know, where is my fail? Debug will detect nothing. Compiler compile my application without problems, BUT after running application program generate error SIGSEGV.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #4

            Can you show your .pro file ?

            Which Linux distribution are you using ?
            Which version of GDB ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • K Offline
              K Offline
              KapitanF
              wrote on last edited by
              #5

              Debugger is:
              GNU gdb (GDB) Fedora 8.0-20.fc26

              OS:
              Fedora 26 (last update kernel 4.11.11-300)

              Here is .pro file:
              [0_1502664502899_QtSslReceiver.pro](Uploading 100%)

              1 Reply Last reply
              0
              • K Offline
                K Offline
                KapitanF
                wrote on last edited by
                #6

                Some other ideas?

                mrjjM 1 Reply Last reply
                0
                • K KapitanF

                  Some other ideas?

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #7

                  @KapitanF

                  Hi
                  All we see it
                  [0_1502664502899_QtSslReceiver.pro](Uploading 100%)

                  Do you see real images?

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    KapitanF
                    wrote on last edited by
                    #8

                    No ,i see only [0_1502664502899_QtSslReceiver.pro](Uploading 100%), i not see real images.

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      karlheinzreichel
                      wrote on last edited by
                      #9

                      To localize the problem it could be a good idea to use the qt-libraries with symbols (debug version of qt-build)

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        KapitanF
                        wrote on last edited by
                        #10

                        Hi Karl, thanks for Reply, where i find the debug version of qt-build?

                        1 Reply Last reply
                        0
                        • K Offline
                          K Offline
                          KapitanF
                          wrote on last edited by
                          #11

                          All needed QT files installed on my OS. I know, Debug not work only on my application! Is it SIGNAL from kernel OS, which raise exception SIGSEGV, or is it application compile/dynamic linker error. Is problem in QMAKE, GCC, GDB or CMAKE?

                          1 Reply Last reply
                          0
                          • K Offline
                            K Offline
                            KapitanF
                            wrote on last edited by
                            #12

                            Any ideas?

                            mrjjM 1 Reply Last reply
                            0
                            • K KapitanF

                              Any ideas?

                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by
                              #13

                              @KapitanF
                              since none of the images or code is shown, it hard to guess at anything. :)

                              1 Reply Last reply
                              0
                              • K Offline
                                K Offline
                                KapitanF
                                wrote on last edited by
                                #14

                                Ok i understand. I have not permissions to Drag and Drop! Ho i enable it?

                                1 Reply Last reply
                                0
                                • K Offline
                                  K Offline
                                  KapitanF
                                  wrote on last edited by
                                  #15

                                  main.cpp : https://pastebin.com/cPjTKygq
                                  qtsslreceiver.cpp : https://pastebin.com/dEtj6E7n
                                  qtsslreceiver.h : https://pastebin.com/TzcktAay
                                  qtsslreceiver.pro : https://pastebin.com/KujH0e8k
                                  qtsslreceiver.ui : https://pastebin.com/kLxVkFxE

                                  I dont know, how enable Drag and Drop for this forum.

                                  1 Reply Last reply
                                  0
                                  • mrjjM Offline
                                    mrjjM Offline
                                    mrjj
                                    Lifetime Qt Champion
                                    wrote on last edited by mrjj
                                    #16

                                    Hi
                                    One thing that i noted.
                                    you define
                                    QSslSocket *msocket;
                                    but do not set to nullptr
                                    and then use it later

                                    
                                    void QtSslReceiver::OnConnect(const QString &hostname,unsigned short port)
                                    {
                                        if (!msocket) <<<< Might not be null, might be random value here
                                        {
                                            msocket = new QSslSocket(this);
                                        xx
                                        }
                                    
                                        msocket->ignoreSslErrors(); <<< Might crash here
                                    
                                    

                                    To check if that
                                    just try
                                    msocket=nullptr; ( or set it to null in .h)
                                    OnConnect("kapitanf.ddns.net", 5000);

                                    Thats stops it crashing here when i run it.

                                    1 Reply Last reply
                                    1
                                    • K Offline
                                      K Offline
                                      KapitanF
                                      wrote on last edited by
                                      #17

                                      Hi mrjj, thank you for Solution. Now application work right. THANK you very much.

                                      1 Reply Last reply
                                      1
                                      • mrjjM Offline
                                        mrjjM Offline
                                        mrjj
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #18

                                        Oh super . it was only that. the revenge of the uninitialized variable. ;)

                                        1 Reply Last reply
                                        0

                                        • Login

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • Users
                                        • Groups
                                        • Search
                                        • Get Qt Extensions
                                        • Unsolved