Man, I can't say I would ever make a mistake so big as to put myself in THAT situation outside of my immediate escape, in which case there's no way to get ahold of any kind of firearm. Regardless, in that close proximity with that many zombies, you are fucked. Unless you are the greatest marksman in the world, you are not going to put down nineteen zombies coming from two sides before one of them gets you. How would you even get in that position? In order to be trapped in a corridor that small with that many of the fuckers, you're going to have to have waltzed past the first group to begin with unless you decided to nap in an enclosed corridor for some unexplainable reason! Any sane individual with the slightest bit of foresight would not wind up in that situation.
As for the first picture, you do realize anything that impassable would be clearly visible from a distance, correct? A line of trees, well that's one thing. You do realize you can walk between those, right? Sure, it's impractical as Hell and a bad idea, but you're not trapped unless the forest is on fire. In terms of an actually impassable structure, you shouldn't be wandering that close to begin with. With soldiers and all that it's one thing, you want to stay close to cover, but zombies cannot shoot you. In the event of zombies, cover is something to be avoided. If you're thinking ahead by anything more than five minutes into your future, you'll wisely avoid any areas where you can be surrounded by zombies before you've had a reasonable chance to dart by them. You're basically setting up a scenario for "if you're an idiot, you might need this." Anyone who's dumb enough to get cornered like that isn't someone I'd like to trust with a gun.