When I was in college, many, many moons ago, I worked for a small local company who dealt in "damaged freight". The boss had a contract with Affiliated Foods warehouse in the big city and sent bob-tail trucks down daily to pick up anything that was damaged by handling. Most of it was canned food items, everything you could imagine in a grocery store, except fresh foods.
We had a retail grocery store that sold the items, we also wholesaled to some smaller mom and pop grocery stores around the area.
Out of a damaged case of canned green beans for example, most of the cans would be un-damaged, some might be bent, slightly or severly, some might be leaking. We opened up the boxes and sorted them out. We had a guy whose job it was to wash cans and bottles that were not damaged, but had product spilled on them in the case.
Badly dented cans (not saleable), leaking cans, or "puffed" cans went into the trash. Same if paper labels were damaged or missing. The rest were sold at a discount to the public in the store or wholesaled.
"Puffed" cans or bottles contain spoiled food, and should never be purchased or eaten. Product spoils in every store, even upscale stores. They don't necessarily have to have been dented.
Look at can lids and bottle lids. They have a purpose design. If badly spoiled, the pressure of the spoiled food makes the lid bulge out or "puff up". It's very visible. You should be able to press on the center of the lid with your thumb and not have it "click" or move up and down, another indication of something wrong in the can. Glass jar lids have a dimple in the center the for the same purpose. Baby food jars are an easy one to look at for this design, and one we looked at very closely for spoilage.
Since we were in the "damaged freight" business we were constantly on the lookout for spoiled goods on the shelves. It was not rocket science. I have to presume that supermarkets today also visually inspect their goods on the shelf, at least I hope that they do.
Today, since I'm paying full retail at my supermarket, I avoid dented cans, but I'm not necessarily scared of them. Bottom line is to look for the state of the lids to assure yourself that the contents inside are not spoiled. Heck, check you own pantry at home. Stuff goes bad sometimes. The food may have been compromised before it was canned, and it takes awhile for it to spoil.
More than you ever wanted to know about my college part-time sack-boy job???