Monday, 20 May 2013

"warning: Invalid parameter passed to C runtime function."

What a frustrating thing to see an error message "warning: Invalid parameter passed to C runtime function." in debugger window without any notice, what does it mean.

I wasn't able to google any useful information, so "I'm just going to leave this here" for those who also stuck at it.

The message "Invalid parameter passed to C runtime function." is being dumped into debugger in msvcrt.dll function __invoke_watson(), using well-known OutputDebugStringA().

Well, this can be easily seen using IDA disassembler. But how we can trace, what was a reason to signal this error? Especially when debugging MinGW-compiled win32-binary in GDB debugger? Just set breakpoint at OutputDebugStringA function (typing break OutputDebugStringA) and then dump your stack (typing bt).

In may case, my program was passing NULL parameter to strcmp() function located in msvcrt.dll, so that's why it (fairly) signalled about error.

Nov-2019: I wrote a full explanation of this story for my "Reverse Engineering for Beginners" book.


  1. Nice tip! Makes sense too, now that I think about it. Thanks.

  2. More detailed explanation with example would be great here!