Fixed hang when JPEG image headers are too short