If you already notice larvae in your rice, you can safely store rice in the freezer for up to one month, which should kill off the existing maggots.
Although maggots will probably die within a few days, I like to be extra sure and leave it there for at least one week to ensure they all die. Freezing your rice beyond that will leave little moisture left in the rice.
Another way to kill maggots is to put them in a scorching environment – around 120-140F for 3 hours. Maggots cannot handle extreme conditions well.
Additionally, if you have Boric Acid on hand, you can sprinkle just a little bit into your food with the maggots to kill it off fast. Note that too much of this may be toxic to you as well.
Finally, you can also use airtight bags or oxygen absorbers. Since maggots need oxygen to survive, these are two great options that I use together when my rice has maggots in it.