وللمضطر أكل آدمي ميت إذا لم يجد ميتة غيره كما قيده الشيخان في الشرح والروضة لأن حرمة الحي أعظم من حرمة الميت وإستثنى من ذلك ما إذا كان الميت نبياً فإنه لا يجوز الأكل منه جزماً فإن قيل كيف يصح هذا الإستثناء والأنبياء أحياء في قبورهم يصلون كما صحت به الأحاديث أجيب بأنه يتصور ذلك من مضطر وجد ميتة نبي قبل دفنه وأما إذا كان الميت مسلماً والمضطر كافراً فإنه لا يجوز الأكل منه لشرف الإسلام وحيث جوزنا أكل ميتة الآدمي لا يجوز طبخها ولا شيها لما في ذلك من هتك حرمته ويتخير في غيره بين أكله نيئاً وغيره وله قتل مرتد وأكله وقتل حربي ولو صغيراً أو إمرأة وأكله لانهما غير معصومين وانما حرم قتل الصبي الحربي والمرأة الحربية في غير الضرورة لا لحرمتهما بل لحق الغانمين وله قتل الزاني المحصن والمحارب وتارك الصلاة ومن له عليه قصاص وإن لم يأذن الإمام في القتل لأن قتلهم مستحق
البجيرمي على الخطيب كتاب الصيد والذبائح فصل في الأطعمة
Someone who feels compelled may eat a dead human, if he has not found any dead meat other than this, as the two Sheikhs have stipulated in Al-sharh and Al-rawda, since the prohibition on the living is greater than the prohibition on the dead. The exception to this is if the dead person is a prophet, in which case it is resolutely not permissible to eat of them. If someone should say: “How does this exception make sense, being that the prophets are alive in their graves, praying, as affirmed in the hadith?”, I would answer: By the fact that this is understood by the person under pressure who finds the dead meat of a prophet before his burial. And if the dead person is a Muslim, and the one under pressure a Kafir, it is not permissible to eat of him, in light of the dignity of Islam. Moreover wherever we have made it permissible to eat the dead meat of humans, it is not permissible to cook it or roast it, as this would disgrace its sanctity, and one must prefer between eating it raw and otherwise.
And one may kill [i.e. if compelled by necessity] an apostate and eat him, or kill a combatant, even a child or a woman, and eat them, since children and women are not blameless; indeed the prohibition on killing a boy combatant or a woman combatant, when there is no necessity, is not because of their sanctity, but rather for the claims of those who go after the spoils. And one may kill a married adulterer, or a fighter, or someone who abandons prayer, or anyone for whom retaliation is due, even if the imam has not given permission to kill, because such as these deserve to be killed.
Al-Bujairmi, Hashiya Al-Bujairmi ‘ala Al-Khatib [Al-Bujairmi's Commentary on the Al-Iqna' of Al-Khatib], The book of hunting and sacrifices, Chapter: foods