Assuming that masks never contains arbitrary symbols, this should just be a checkState