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. Invalid parameter passed to c runtime

Invalid parameter passed to c runtime

Scheduled Pinned Locked Moved Unsolved General and Desktop
16 Posts 8 Posters 9.0k Views
  • 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.
  • U Offline
    U Offline
    UnLuckyGuy
    wrote on last edited by
    #1

    How could i find the line of code, or function causing these problems? Please don't paste me any junky articles from MS, documentations, etc, they don't explain it well, especially if i get it first time.

    Is there any way of doing it? Debugger can't find them, and i get a lot of code there, i got some of them i fix it, but after adding new code, the errors are back, and i don't have time to lose 8h for debugging stuff, and 30min for programming.

    Someone could help? How to find the line or function, causing it?

    aha_1980A kshegunovK 2 Replies Last reply
    0
    • U UnLuckyGuy

      How could i find the line of code, or function causing these problems? Please don't paste me any junky articles from MS, documentations, etc, they don't explain it well, especially if i get it first time.

      Is there any way of doing it? Debugger can't find them, and i get a lot of code there, i got some of them i fix it, but after adding new code, the errors are back, and i don't have time to lose 8h for debugging stuff, and 30min for programming.

      Someone could help? How to find the line or function, causing it?

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      HI @UnLuckyGuy,

      does your program crash? If yes, then start it in the debugger, it will stop the program at the crash point. Then you can inspect the stack trace to see from where in your program the error originates.

      Otherwise: Can you show us the places you already fixed your code? Maybe we can see a pattern.

      Regards

      Qt has to stay free or it will die.

      1 Reply Last reply
      1
      • U Offline
        U Offline
        UnLuckyGuy
        wrote on last edited by UnLuckyGuy
        #3

        Ofc it crash, QT 5.20 doesn't show anything in debug mode, 5.60, will stop on some weird code, i think they are some dll's, it will not stop on any of "readable" code i just created, weird stuff from ntdll or something like this. THe best thing is, my program crashed in another situation, 5 times in a row, when i was doing the same action (button click), and then, it stops, no more crashes at that situation, idk if it's because i moved it from 5.20, but i am mad at it.

        Anyways, i want the code, what kind of code cause it.
        I am not gonna paste any code, because it's simple.
        Most the time, they are neasted for loops, so:

        for(int i = 0; i < SOMTHING; i++)
        {
        for(int j = another_parameter; j < SOMETHING_ELSE; j++)
        {
        new_string.append( old_strings[i][j] );
        }
        }
        
        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          So you should check if old_strings[][] is large enough to avoid out-of-bounds access.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          U 1 Reply Last reply
          3
          • Christian EhrlicherC Christian Ehrlicher

            So you should check if old_strings[][] is large enough to avoid out-of-bounds access.

            U Offline
            U Offline
            UnLuckyGuy
            wrote on last edited by UnLuckyGuy
            #5

            @Christian-Ehrlicher I did it already, it was just an example. What i do:

            for(int i = 0; i < SOMTHING; i++)
            {
            for(int j = another_parameter; j < old_strings[i].count(); j++)
            {
            new_string.append( old_strings[i][j] );
            }
            }
            
            1 Reply Last reply
            0
            • U UnLuckyGuy

              How could i find the line of code, or function causing these problems? Please don't paste me any junky articles from MS, documentations, etc, they don't explain it well, especially if i get it first time.

              Is there any way of doing it? Debugger can't find them, and i get a lot of code there, i got some of them i fix it, but after adding new code, the errors are back, and i don't have time to lose 8h for debugging stuff, and 30min for programming.

              Someone could help? How to find the line or function, causing it?

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by
              #6

              i don't have time to lose 8h for debugging stuff, and 30min for programming.

              Perhaps you should consider another job in that case, because this is not at all uncommon.

              Read and abide by the Qt Code of Conduct

              U 1 Reply Last reply
              7
              • kshegunovK kshegunov

                i don't have time to lose 8h for debugging stuff, and 30min for programming.

                Perhaps you should consider another job in that case, because this is not at all uncommon.

                U Offline
                U Offline
                UnLuckyGuy
                wrote on last edited by
                #7

                @kshegunov Who told u i am gonna work as a programmer?

                kshegunovK 1 Reply Last reply
                -2
                • Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Still no check if old_strings[i] goes out-of-bounds. But using a debugger here will definitively help as it can you your the values of i,j and (if it's not a plain c array) old_strings.

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  1 Reply Last reply
                  1
                  • U UnLuckyGuy

                    @kshegunov Who told u i am gonna work as a programmer?

                    kshegunovK Offline
                    kshegunovK Offline
                    kshegunov
                    Moderators
                    wrote on last edited by kshegunov
                    #9

                    @UnLuckyGuy said in Invalid parameter passed to c runtime:

                    Who told u i am gonna work as a programmer?

                    With this demeanor I'm not quite sure you're going to work at all, but that's beside the point. Without enough and complete information no problem can be diagnosed or fixed.
                    You have denied to show us the relevant parts of the code, what variable types are the suspects involved, the stack trace - those winnt dll calls originate somewhere, they don't just fall out of the sky, and last but (probably) not least you have acted as we, the users of this forum, owe you our time.
                    Just to make sure that last one rings: we don't owe you, neither time, nor code, nor anything else, so don't try to act as if we do; it doesn't sit well and it doesn't help your case. We try to help other people on our own (free) time and we are not paid for it so as to feel obliged to indulge you.

                    Read and abide by the Qt Code of Conduct

                    U 1 Reply Last reply
                    9
                    • kshegunovK kshegunov

                      @UnLuckyGuy said in Invalid parameter passed to c runtime:

                      Who told u i am gonna work as a programmer?

                      With this demeanor I'm not quite sure you're going to work at all, but that's beside the point. Without enough and complete information no problem can be diagnosed or fixed.
                      You have denied to show us the relevant parts of the code, what variable types are the suspects involved, the stack trace - those winnt dll calls originate somewhere, they don't just fall out of the sky, and last but (probably) not least you have acted as we, the users of this forum, owe you our time.
                      Just to make sure that last one rings: we don't owe you, neither time, nor code, nor anything else, so don't try to act as if we do; it doesn't sit well and it doesn't help your case. We try to help other people on our own (free) time and we are not paid for it so as to feel obliged to indulge you.

                      U Offline
                      U Offline
                      UnLuckyGuy
                      wrote on last edited by UnLuckyGuy
                      #10

                      @kshegunov I am looking for any technique, to find those errors, that's it. I don't wanna show anything, because it's not my point.

                      I found something like this: https://msdn.microsoft.com/en-us/library/a9yf33zb.aspx

                      Idk how to use those methods, that's why i create this topic for future, if it will happened, i will know how to find them, not to fix this particular one by showing a lot of code, and after few days it could happened again.

                      1 Reply Last reply
                      0
                      • U Offline
                        U Offline
                        UnLuckyGuy
                        wrote on last edited by
                        #11

                        No body knows, how to do that?

                        K J.HilkJ 2 Replies Last reply
                        0
                        • U UnLuckyGuy

                          No body knows, how to do that?

                          K Offline
                          K Offline
                          kenchan
                          wrote on last edited by
                          #12

                          @UnLuckyGuy
                          Hi, this seems to be a very hard one to debug. Do you know about these links? If not I hope they will be of some help.

                          https://stackoverflow.com/questions/36968475/how-to-debug-invalid-parameter-passed-to-c-runtime-function
                          http://dennisyurichev.blogspot.com/2013/05/warning-invalid-parameter-passed-to-c.html

                          Good luck.

                          1 Reply Last reply
                          1
                          • U UnLuckyGuy

                            No body knows, how to do that?

                            J.HilkJ Online
                            J.HilkJ Online
                            J.Hilk
                            Moderators
                            wrote on last edited by J.Hilk
                            #13

                            @UnLuckyGuy
                            you still haven't told us jet, what the stack trace is telling you.

                            You only wrote:

                            "readable" code i just created, weird stuff from ntdll or something like this

                            that's fine, sometimes, especially if you call system or other external libaries, the debugger can stop in the Disassembler or plain old hex text. You can go back in the call list, until you reach your own 'clean text' code.

                            take for example this crash:

                            0_1533881781942_7207a3e7-df0e-43c3-861e-56b121f5db9c-image.png

                            on the first glance meaningless, but going back you a can see a QVector operation was called, bottom part of the image.

                            going back in the list
                            0_1533881927736_28224422-f87c-4ced-9da2-8e4bf4a8a067-image.png

                            this tells us, a Qvector was tried to be accessed outside its boundaries. Still doesn't say much, a program can have millions of QVectors.

                            going back one more:

                            0_1533882006188_b826408e-6e47-4b5e-919d-59deaa82fe55-image.png

                            and there is the culprit. Doesn't matter much, if you don't use QtCreator, nearly all IDE's have a similar system.


                            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                            Q: What's that?
                            A: It's blue light.
                            Q: What does it do?
                            A: It turns blue.

                            aha_1980A JonBJ 2 Replies Last reply
                            8
                            • J.HilkJ J.Hilk

                              @UnLuckyGuy
                              you still haven't told us jet, what the stack trace is telling you.

                              You only wrote:

                              "readable" code i just created, weird stuff from ntdll or something like this

                              that's fine, sometimes, especially if you call system or other external libaries, the debugger can stop in the Disassembler or plain old hex text. You can go back in the call list, until you reach your own 'clean text' code.

                              take for example this crash:

                              0_1533881781942_7207a3e7-df0e-43c3-861e-56b121f5db9c-image.png

                              on the first glance meaningless, but going back you a can see a QVector operation was called, bottom part of the image.

                              going back in the list
                              0_1533881927736_28224422-f87c-4ced-9da2-8e4bf4a8a067-image.png

                              this tells us, a Qvector was tried to be accessed outside its boundaries. Still doesn't say much, a program can have millions of QVectors.

                              going back one more:

                              0_1533882006188_b826408e-6e47-4b5e-919d-59deaa82fe55-image.png

                              and there is the culprit. Doesn't matter much, if you don't use QtCreator, nearly all IDE's have a similar system.

                              aha_1980A Offline
                              aha_1980A Offline
                              aha_1980
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              @J.Hilk Thanks for that very nice explanation :) Should be in a FAQ entry, IMHO.

                              Qt has to stay free or it will die.

                              1 Reply Last reply
                              5
                              • J.HilkJ J.Hilk

                                @UnLuckyGuy
                                you still haven't told us jet, what the stack trace is telling you.

                                You only wrote:

                                "readable" code i just created, weird stuff from ntdll or something like this

                                that's fine, sometimes, especially if you call system or other external libaries, the debugger can stop in the Disassembler or plain old hex text. You can go back in the call list, until you reach your own 'clean text' code.

                                take for example this crash:

                                0_1533881781942_7207a3e7-df0e-43c3-861e-56b121f5db9c-image.png

                                on the first glance meaningless, but going back you a can see a QVector operation was called, bottom part of the image.

                                going back in the list
                                0_1533881927736_28224422-f87c-4ced-9da2-8e4bf4a8a067-image.png

                                this tells us, a Qvector was tried to be accessed outside its boundaries. Still doesn't say much, a program can have millions of QVectors.

                                going back one more:

                                0_1533882006188_b826408e-6e47-4b5e-919d-59deaa82fe55-image.png

                                and there is the culprit. Doesn't matter much, if you don't use QtCreator, nearly all IDE's have a similar system.

                                JonBJ Offline
                                JonBJ Offline
                                JonB
                                wrote on last edited by
                                #15

                                @J.Hilk
                                Unfortunately the OP has told us "he doesn't want to waste his time debugging", he just wants the solution. ;-)

                                1 Reply Last reply
                                4
                                • PadawanP Offline
                                  PadawanP Offline
                                  Padawan
                                  wrote on last edited by
                                  #16

                                  Haha, Funny thread
                                  @J-Hilk thanks for the explanation you gave up there about debugging. It taught me something new

                                  Ningen

                                  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