Lets clarify a couple things, two DIFFERENT causes resulting in firing are being called "slam fires", and while the result is the same (the round fires) they happen for different reasons and should not be confused.
Slam Fire refers to the closing bolt firing the round, whether there is a finger of the trigger, OR NOT.
Several common military rifle designs use a floating firing pin, which, literally bounces off the primer when the bolt closes. This is intentional, and why a certain hardness of primer cup metal is required for proper, safe operation.
Things are engineered so that the round won't be fired, until the hammer falls, but malfunctions. such as a stuck firing pin or using the wrong primer in the ammo can result in the round firing unintentionally. This is a slam fire.
A rifle doubling because of recoil jarring off a too light engagement of the trigger/sear/hammer is not a slam fire in the same sense.
Old vets can tell you that there are some people who can get an M1 or M14 to double, or even more (with a stock trigger group), by holding the trigger and the rifle in just the right way during recoil, and that is a bump fire. Done simply by technique not using any special (now banned) stock. I could never learn the trick to be able to do it intentionally but I've seen it done, accidentally.
it is entirely possible to create a rifle where the shock of just the action cycling shut will jar off the sear engagement, firing the gun. Not a safe condition, it is a malfunction that needs immediate repair. This usually happens when people try to get the "best possible" (meaning lightest) trigger pull. I've even done it with a bolt action, just by adjusting the trigger TOO much.
SO, if the rifle fires as the action shuts, with no finger on the trigger it's a slam fire and there a couple different causes. If it fires a second time while you're pulling the trigger its most likely either being jarred off, or you have unintentionally bump fired it.
A severely overlong case, one that doesn't allow the rifle to fully go into battery (and with a hard enough primer for a floating firing pin system) shouldn't slam fire, unless its in a fixed firing pin gun, such as many SMGs.