On the Robustness of ChatGPT: An Adversarial and Out-of-distribution Perspective