Yams are generally considered to be a safe food for ulcer patients, as they are low in acidity and can help to soothe the stomach lining. However, it is important to prepare yams properly and avoid adding any irritating spices or seasonings.