Make sure that palette entries don't exceed max.