The only way it can expand is down the cylinder, the barrel of the gun. If a projectile (a bullet, for example) is in the way, the expanding matter from the explosion will push the projectile forward as it makes its way down the barrel.