Fix codec: malformed messages should not crash endpoints. Fixes OOIION-668