Hello There,
Both the possibilities you have suspected might be the reason of your problem. In case of food intolerance only stomach bloating and gas passage are the only symptoms. But if Foul smell of gases strongly suggests bacterial or Worm infection.
Next Steps
Visit to your family doctor or Physician for thorough clinical examination, Diagnosis and Treatment.
Health Tips
Do not take any medication without doctor's consultation.