That does not invalidate his fast, but it does detract from his reward. The Muslim should control himself and guard his tongue against swearing, reviling, backbiting, gossiping and other things that Allaah has forbidden whether one is fasting or not. But when one is fasting it is more serious and he should be more careful in preserving the integrity of his fast, and avoid that which will harm people or be a cause of trouble, anger and division, because the Prophet (peace and blessings of Allaah be upon him) said: “If one if you is fasting, let him not utter obscenities on that day or raise his voice, and if anyone reviles him or wants to pick a fight with him, let him say ‘I am a person who is fasting.’” Agreed upon.
And Allaah is the Source of strength. May Allaah send blessings and peace upon our Prophet Muhammad and his family and companions.