Safety Verification and Robustness Analysis of Neural Networks via Quadratic Constraints and Semidefinite Programming