jpeg2000dec: Add more checks when parsing headers