Since parseAllHeaders is being called you must have PEDANTIC_STACK preprocessor flag turned on.
Check out the code in TransactionState.cxx - search for #ifdef PEDANTIC_STACK. If we fail to parse a SIP message the exception should be caught and we call handleBadRequest which attempts to respond with 400 - assuming there are enough good headers to allow formation of a response.
What do you mean by hanged? Does it deadlock, trap or tight spin?
Can you create a small test program, similar to resip/test/testSipMessage.cxx that tries to call parseAllHeaders on your invalid SipMessage and can demonstrate the problem?
Thanks,
Scott