Fix to prevent crashing on malformed JPEG2000 files