Fixed: Broken HTML could cause message_apply_formatting to get stuck in an infinite loop.