The buffer "length" refers to the extension tube length. Carbine is for adjustable stocks, and rifle length (aka A2) is for A2 fixed stocks. Carbine also refers to a particular weight of buffer for a carbine buffer system. Gas system shouldn't make much difference in buffer system (other than the buffer weight).
You can do it. Collapsible stocks have shorter springs and buffers. The buffers are usually heavier to account for the increased impetus from the shorter carbine gas system. These buffers are usually marked 'H' and 'H2'. The rifle upper should work fine on it, but there is the possibility of short-cycling, in which case you would need the older, lighter carbine buffer. But, if it ejects and loads, you're GTG. Under no circumstances can you use the longer rifle buffer in the short carbine buffer tube - the buffer would slam into the end of the tube and it might not fully cycle the action. The same goes for the longer rifle recoil spring, which would probably bind (go solid) and the rifle wouldn't fully cycle.
BTW, the M16, M16A1 and M16A2 buffer tubes, springs and buffers are all essentially the same. The 'A2' stock is longer, but it has a spacer for the end of the buffer tube. I run a M16A1 stock assembly on my 16" carbine with mid-length gas system and it's a very smooth shooter.
You may need to play with buffer weights in the carbine lower to find what works best with your chosen ammo in a rifle length system. But, it's been and is being done. You just may need some tweaking. Or not. A lot depends on the combination of components. Proper specs on everything, to include the size of the gas port in the barrel? Gas block and tube in spec and installed properly? What BCG will you be running, AR15, AR15 Enhanced, M16 (heavy)? Those kinds of things can make a difference. Particularly when mixing a system.
as was stated, gas length and buffer length are separate systems. my lower has a carbine length tube with a h2 buffer and both my uppers run great on it. one is an 18" with a rifle length gas system and the other is a 14.5" with a mid length gas system. i havent tried russian ammo, but everything else i have tried has cycled well.
Does it work to mount a rifle upper onto a carbine lower?
Yes, I've done it for over 20 years. Mine always work without failure.
It wasn't originally designed that way, but if the upper and lower
are safe and both in good operating condition it works great,
although I suppose you can find some questionable ammunition somewhere
that doesn't like it. But questionable ammunition doesn't like anything.