ensure reading invalid images from buffers properly throw