It is certain that the one who is fasting has to avoid haraam things, such as backbiting, lying, gossiping, wronging others etc., because the purpose of fasting is not only to refrain from eating, drinking and having intercourse, rather the aim behind it is to fear Allaah, as Allaah says (interpretation of the meaning):
“O you who believe! Observing As-Sawm (the fasting) is prescribed for you as it was prescribed for those before you, that you may become Al-Muttaqoon (the pious)”
Every sin that a fasting person commits detracts from the reward of his fast, and a fasting person may continue sinning and reducing his reward until he loses the reward for his fasting altogether. Concerning that the Messenger (peace and blessings of Allaah be upon him) said: “A fasting person may get nothing from his fasting except hunger.” Narrated by Ibn Maajah (1690), classed as saheeh by al-Albaani in Saheeh Ibn Maajah.
So what the fasting person must do is repent from his sins and turn back to Allaah and do good deeds, so that Allaah will accept his fasting.
But with regard to whether his fast is valid or not, fasting is not rendered invalid just by committing a sin such as wronging others or lying, but that detracts from the reward. This has been discussed in the answer to question no. 50063.
And Allaah knows best.