Certain joints acting incorrectly when playing a certain animation

This is a problem I’ve been having lately, pretty consistently, too–when playing an animation that only animates some body parts, like the arms for example, other body parts, usually the torso, bug out. Typically, it leans forward or backwards when I don’t want it to. Here’s a visual:

(Notice how it leans forward while the arms are up, but stops when they go back down)

This has been happening on other games of mine as well, and as far as I can tell, only happens when I play an animation that doesn’t animate every joint. I’m not sure what the problem is. It happens on any rig.
Is there something I’m missing, or a good fix for this?