Unsolved Invalid parameter passed to c runtime
-
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] ); } }
-
So you should check if old_strings[][] is large enough to avoid out-of-bounds access.
-
@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] ); } }
-
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.
-
@kshegunov Who told u i am gonna work as a programmer?
-
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.
-
@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. -
@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.
-
No body knows, how to do that?
-
@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.htmlGood luck.
-
@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:
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
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:
and there is the culprit. Doesn't matter much, if you don't use QtCreator, nearly all IDE's have a similar system.
-
@J.Hilk Thanks for that very nice explanation :) Should be in a FAQ entry, IMHO.
-
@J.Hilk
Unfortunately the OP has told us "he doesn't want to waste his time debugging", he just wants the solution. ;-) -
Haha, Funny thread
@J-Hilk thanks for the explanation you gave up there about debugging. It taught me something new