What should I do if gas is trapped between my liver and rib?

See your doctor! This is one of those problems where a visit to your doctor is necessary to figure out what's going on. Only after a thorough evaluation, including examination and possibly labs and other tests, can your doctor correctly diagnose you and treat you effectively.