What an elastic system! The Pope can be evil, and your doctrine from a sink of iniquity will be good !

The Catholic Answers

The Pope cannot be evil in the sense that he is free to be wicked. He is not morally free to do as he pleases. But if some rare and individual Pope did happen unfortunately to be wicked, then we say that God would infallibly preserve him from error in such ex cathedra definitions as he might be called upon to make for the good of the whole Church. After all, under God’s providence, the false prophet Balaam and Caiphas the Jewish Priest, both men of evil dispositions, predicted and taught the truth in spite of themselves.

Radio Replies Volume 1 by Rev. Dr. Leslie Rumble MSC and Rev. Charles Mortimer Carty