104:4 The idea that one may do work to prevent a loss only applies if it wasn’t possible to do the work before yom tov. If it was possible to do it before yom tov and one left it until chol hamoed, it is then forbidden to do it on chol hamoed.
104:5 All work that’s forbidden to perform on chol hamoed, if there is a Jew who doesn’t have sufficient food to eat for chol hamoed and yom tov, the work may be done by him so that he will have what to eat. (Mishnah Brurah 542:7 discusses what is considered sufficient. It seems that a bare minimum is considered “sufficient” for the purposes of this halacha. However, MB 542:8 tells us that he may perform the work even if he has household utensils that might be sold to buy food.) In any event, the work should be performed in private (because others don’t know the situation; if this is not possible, the work may be performed in public – MB 542:7). It’s forbidden to do such work through a non-Jew, but for the sake of a mitzvah it is permitted (to have it done by a non-Jew – MB 543:1).