avcodec/exr: Check buf_size more completely