you bet! it's a great way to rescue an otherwise ruined mask. just try to do it in stages so you don't overfill and distort your mask. it's also a good time to have a chunk of pvc ready to encase in the foam to give yourself a stem to use if your making it into a static prop
Allen Hops aka Stiltbeast recently posted a video on You Tube on filling masks with this new product from Home Depot. I went out and bought it, but have not had a chance to try it out. Search for Stiltbeast/filling latex masks. He uses this product intended to set posts in the ground, but it's basically A/B foam mix.