The corn kernels are safe, but the cob is a serious intestinal-obstruction risk.
Cobs do not break down in the digestive tract. They lodge in the small intestine and frequently require surgical removal.
Corn cobs are dense, fibrous and roughly the diameter of the canine small intestine — a near-perfect obstruction. Unlike most foreign bodies, cob fragments do not soften or fragment with stomach acid; they pass into the small intestine intact and cause partial or complete blockage.
Sources
Any ingestion of cob — even chewed pieces — warrants a same-day vet visit. Surgery is required in many cases.